Python GUIZero – AttributeError: объект «NoneType» не имеет атрибута «tk»Python

Программы на Python
Ответить
Anonymous
 Python GUIZero – AttributeError: объект «NoneType» не имеет атрибута «tk»

Сообщение Anonymous »

Опишите ошибку
Использование нескольких «Изображений» приводит к сбою программы.
Для воспроизведения
Шаги по воспроизведению поведения:

Код: Выделить всё

#GUI Classes
from guizero import App, PushButton, Picture, Text, Box, Window
import os

appDir = os.path.dirname(os.path.realpath(__file__))
app = App("Testing")

options = Box(app, layout="grid", width="fill")
Picture(options, appDir + '/images/icons/dark/100x100Filters-Icon@4x.png', width=100, height=100, grid=[0,0])
Picture(options, appDir + '/images/icons/dark/100x100PhotoFrames-Icon@4x.png', width=100, height=100, grid=[1,0])
Picture(options, appDir + '/images/icons/dark/100x100Stickers-Icon@4x.png', width=100, height=100, grid=[2,0])
Picture(options, appDir + '/images/icons/dark/100x100Timer-Icon@4x.png', width=100, height=100, grid=[3,0])
Picture(options, appDir + '/images/icons/dark/100x100Lights-Icon@4x.png', width=100, height=100, grid=[4,0])

filters = Box(app, layout="grid", width="fill").hide()

Picture(filters, appDir + '/images/icons/dark/100x100Smooth-Icon@4x.png', width=100, height=100, grid=[0,0])
Picture(filters, appDir + '/images/icons/dark/100x100SmoothM-con@4x.png', width=100, height=100, grid=[1,0])
Picture(filters, appDir + '/images/icons/dark/100x100Reset-Icon@4x.png', width=100, height=100, grid=[2,0])
Picture(filters, appDir + '/images/icons/dark/100x100Back-Icon@4x.png', width=100, height=100, grid=[3,0])

app.display()
Ожидаемое поведение
Отображение изображений с помощью GUI Zero
Снимки экрана
Изображение

Информация о системе:
  • ОС: Windows и Pi 4
    Версия Guizero: Windows (1.50) — Pi (1.40)
Дополнительный контекст

Код: Выделить всё

C:\Users\youca\Desktop\Photobooth App>python Test.py Traceback (most recent call last): File "C:\Users\youca\Desktop\Photobooth App\Test.py", line 16, in  Picture(filters, appDir + '/images/icons/dark/100x100Smooth-Icon@4x.png', width=100, height=100, grid=[0,0]) File "C:\Users\youca\AppData\Local\Programs\Python\Python312\Lib\site-packages\guizero\Picture.py", line 55, in __init__ tk = Label(master.tk) ^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'tk'


Подробнее здесь: https://stackoverflow.com/questions/793 ... tribute-tk
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»