While using the Key Logger GUI built with CustomTkinter, two issues were observed
-
CTkLabel Image Warning
- Issue: When setting an image on
CTkLabel using PIL.ImageTk.PhotoImage, the following warning appears:
- Impact: Image may not scale properly on high-DPI displays, and the warning clutters the console.
-
CTkEntry State Error
- Issue: Accessing or modifying the entry widget state using dictionary syntax like
receiver_entry['state'] raises:
- Impact: The application crashes when attempting to enable/disable the email entry field.
Fix
- Replace
ImageTk.PhotoImage with customtkinter.CTkImage for CTkLabel.
- Use
receiver_entry.cget("state") to read state and receiver_entry.configure(state="...") to modify state instead of ['state'].
@AdityaKumar5155 Sir ifix this issue and open a PR #23
Error message
TkLabel Warning: Given image is not CTkImage but <class 'PIL.ImageTk.PhotoImage'>. Image can not be scaled on HighDPI displays, use CTkImage instead.
warnings.warn(f"{type(self).name} Warning: Given image is not CTkImage but {type(image)}. Image can not be scaled on HighDPI displays, use CTkImage instead.\n")
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\mukes\AppData\Local\Programs\Python\Python313\Lib\tkinter_init_.py", line 2068, in call
return self.func(*args)
~~~~~~~~~^^^^^^^
File "C:\Users\mukes\AppData\Local\Programs\Python\Python313\Lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked
self.command()
~~~~~~~~~~~~~^^
File "C:\Users\mukes\OneDrive\Desktop\react\zzzz\KeyLogger5155\app\guikeylogger.py", line 175, in on_button_click
if receiver_entry['state'] == 'normal':
~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\mukes\AppData\Local\Programs\Python\Python313\Lib\tkinter_init.py", line 1828, in cget
return self.tk.call(self._w, 'cget', '-' + key)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: unknown option "-state"
Environment
While using the Key Logger GUI built with CustomTkinter, two issues were observed
CTkLabel Image Warning
CTkLabelusingPIL.ImageTk.PhotoImage, the following warning appears:CTkEntry State Error
receiver_entry['state']raises:Fix
ImageTk.PhotoImagewithcustomtkinter.CTkImageforCTkLabel.receiver_entry.cget("state")to read state andreceiver_entry.configure(state="...")to modify state instead of['state'].@AdityaKumar5155 Sir ifix this issue and open a PR #23
Error message
TkLabel Warning: Given image is not CTkImage but <class 'PIL.ImageTk.PhotoImage'>. Image can not be scaled on HighDPI displays, use CTkImage instead.
warnings.warn(f"{type(self).name} Warning: Given image is not CTkImage but {type(image)}. Image can not be scaled on HighDPI displays, use CTkImage instead.\n")
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\mukes\AppData\Local\Programs\Python\Python313\Lib\tkinter_init_.py", line 2068, in call
return self.func(*args)
~~~~~~~~~^^^^^^^
File "C:\Users\mukes\AppData\Local\Programs\Python\Python313\Lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked
self.command()
~~~~~~~~~~~~~^^
File "C:\Users\mukes\OneDrive\Desktop\react\zzzz\KeyLogger5155\app\guikeylogger.py", line 175, in on_button_click
if receiver_entry['state'] == 'normal':
~~~~~~~~~~~~~~^^^^^^^^^
File "C:\Users\mukes\AppData\Local\Programs\Python\Python313\Lib\tkinter_init.py", line 1828, in cget
return self.tk.call(self._w, 'cget', '-' + key)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: unknown option "-state"
Environment