The PhotoImage class is part of the Tkinter module, just like all the other Tkinter classes you're calling (Label, StringVar, Button, etc). You haven't loaded PhotoImage into the global namespace, so you can't access it simply with PhotoImage. Try tk.PhotoImage instead. self.bg...
针对你遇到的 NameError: name 'imagetk' is not defined 错误,我们可以按照以下步骤进行排查和解决: 1. 确认 imagetk 模块的来源 imagetk 是Python 中 PIL(Python Imaging Library,现为 Pillow)库的一个子模块,用于将 PIL 图像对象转换为 Tkinter 可以使用的格式。因此,imagetk 并不是一个独立的模块,而是 Pi...
self.entry.delete(0, END) image_url = kwargs.get('captcha') im = Image.open(requests.get(image_url, stream=True, timeout=5).raw) image_display = ImageTk.PhotoImage(im, master=self.root) # Removing the previous Image (if present) and # displaying a new one. image_labe...
RuntimeError: main thread is not in main loop [[Node: Loss/PyFunc_1 = PyFunc[Tin=[DT_FLOAT], Tout=[DT_UINT8], token="pyfunc_1", _device="/job:localhost/replica:0/task:0/device:CPU:0"](Loss/Squeeze_1/_6143)]] Exception RuntimeError: 'main thread is not in main loop' in ...