@FlashBoy

Что тут не так? Vk Coin приложение?

Помогите пожалуйста. Можете объяснить что тут не так? Ошибка "AttributeError: 'NoneType' object has no attribute 'delete'"
#Библиотеки

import tkinter as tk
import time

#Настройки окна

win = tk.Tk()
win.geometry(f'450x500')
win.resizable(width = False, height = False)
win.title('VK.COIN [v.1 BETA]')
win.iconbitmap('icon.ico')

#Дефолт-значения

auto = 0
count = 1

#Доп-значения (Автоматические действия)

processorcount = 0
videocardcount = 0
opb = 0

#Доп-значения (Ручные действия)

getmousecount = 0
getheadphonescount = 0
getkeyboardcount = 0

#Доп вычисления (Автоматические действия)
def procescount(proces):
	global processorcount
	processorcount += proces
	processor_count.delete(0, tk.END)
	processor_count.insert(0, processorcount)
	

def vidcardcount(video):
	global videocardcount
	videocardcount += video
	videocard_count.delete(0, tk.END)
	videocard_count.insert(0, videocardcount)

def op(po):
	global opb
	opb += po
	opb_count.delete(0, tk.END)
	opb_count.insert(0, opb)

#Доп вычисления (Ручные действия)

def getmouse1(gm):
	global getmousecount
	getmousecount += gm
	get_mouse_count.delete(0, tk.END)
	get_mouse_count.insert(0, getmousecount)

def gethead(gh):
	global getheadphonescount
	getheadphonescount += gh
	get_headphones_count.delete(0, tk.END)
	get_headphones_count.insert(0, getheadphonescount)

def getkeyb(gk):	
	global getkeyboardcount
	getkeyboardcount += gk
	get_keyboard.delete(0, tk.END)
	get_keyboard.insert(0, getkeyboardcount)
#Основное вычисление

def calculate(operation):
	global count
	count += operation 
	main_coins.delete(0, tk.END)
	main_coins.insert(0, count)


#Добавление коинов

get_count = tk.Button(text = 'Получить ' + str(count) + ' vkcoin', font = ('Arial', 13), bd = 5, bg='deep sky blue',command = lambda: calculate(1)).place(x=115, y=70, width=220, height=100)

#Автоматические действия

processor = tk.Button(text = 'Процессор (5/c) ', font = ('Arial', 10), bd = 5, command = lambda: procescount(1)).place(y=220, width=110, height=30)
videocard = tk.Button(text = 'Видеокарта (20/c) ', font = ('Arial', 10), bd = 5, command = lambda: vidcardcount(1)).place(x=130, y=220, width=120, height=30)
opb = tk.Button(text = 'Оперативная память (50/c) ', font = ('Arial', 10), bd = 5, command = lambda: op(1)).place(x=270, y=220, width=175, height=30)

#Настройки расчета автоматических действий

processor_count = tk.Entry(win, justify = tk.RIGHT, font = ('Arial', 15), state = 'normal').place(y=250, width = 110, height = 30)
videocard_count = tk.Entry(win, justify = tk.RIGHT, font = ('Arial', 15), state = 'normal').place(x=130, y=250, width=120, height=30)
opb_count = tk.Entry(win, justify = tk.RIGHT, font = ('Arial', 15), state = 'normal').place(x=270, y=250, width=175, height=30)

#Настройки автоматических действий 



#Ручные действия

get_mouse = tk.Button(text = 'Мышь (+5 coin)', font = ('Arial', 10), bd = 5, command = lambda: getmouse1(1)).place(y=330, width = 110, height = 30)
get_headphones = tk.Button(text = 'Наушники (+20 coin)', font = ('Arial', 8), bd = 5, command = lambda: gethead(1)).place(x= 130, y=330, width = 120, height = 30)
get_keyboard = tk.Button(text = 'Клавиатура (+50 coin)', font = ('Arial', 9), bd = 5, command = lambda: getkeyb(1)).place(x= 270, y=330, width = 175, height = 30)

#Настройки расчета ручных действий

get_mouse_count = tk.Entry(win, justify = tk.RIGHT, font = ('Arial', 15), state = 'normal').place(y=360, width = 110, height = 30)
get_headphones_count= tk.Entry(win, justify = tk.RIGHT, font = ('Arial', 15), state = 'normal').place(x=130, y=360, width=120, height=30)
get_keyboard_count = tk.Entry(win, justify = tk.RIGHT, font = ('Arial', 15), state = 'normal').place(x=270, y=360, width=175, height=30)

#Настройки ручных действий



#Заголовки к магазинам/виджетам
count_coins = tk.Label(text = 'Кол-во коинов :', font = ('Arial', 13))
magazine = tk.Label(text = '[Магазин] ', font= ('Arial', 20)).place(x=160, y=175)
auto_items = tk.Label(text = '[Автоматические прикалюхи] ', font= ('Arial', 15)).place(x=95, y=180)
hand_items = tk.Label(text = '[Ручные прикалюхи] ', font= ('Arial', 15)).place(x=135, y=290)
count_coins.pack()

#Основное окно для показания кол-ва коинов

main_coins = tk.Entry(win, justify = tk.RIGHT, font = ('Arial', 15), state = 'normal')
main_coins.pack()


win.mainloop()
  • Вопрос задан
  • 78 просмотров
Пригласить эксперта
Ответы на вопрос 1
@Wispik
Метод place() ничего не возвращает, поэтому во всех переменных у тебя None.
Вот так нужно размещать, если потом хочешь обращаться к объекту:
get_mouse = tk.Button(text = 'Мышь (+5 coin)', font = ('Arial', 10), bd = 5, command = lambda: getmouse1(1))
get_mouse.place(y=330, width = 110, height = 30)

И пожалуйста называй переменные нормально. Ну не должна кнопка называться get_mouse, а инпут get_mouse_count
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы