Python Forum
[Tkinter] image doesnt exists into personal module
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] image doesnt exists into personal module
#3
Are you really read my code?

First trying:
=> self.img_logo is initialized into class Gui() (in first script), here line 17 - same for self logo, and self.icon (line 16, 18)...
=> and is built into def ui(), in lines 74-76.
=> when you clic on menu about, the def about() is called; into this method, i code a dict named init - lines 26=>37. this is passed to def __init__() into script 'window_about.py'.
=> into the script 'window_about.py', the self.img_logo is called - line 37 - after builded into lines 15,16

'self.img_logo' is value after 'pimg.open()' of 'self.logo' and pimgtk.Photoimage()...

To be sure 'self.logo', 'self.icon' and 'self.img_logo' is builded, into script 'windows_about.py', i displaying thoses by print - line 17, as we see at the beginning of the error message:

Quote:self.DESCR: Yet Uploader Pixxie.py
self.dir: ~/YUP.py
self.icon: ~/YUP.py/img/Logo.xbm
self.img_logo: pyimage2
self.logo: ~/YUP.py/img/Logo.png
self.NAME: YUPixxie

Second trying:
=> i called only 'self.logo' into 'window_about.py', passed by init...
=> and build 'img_logo' after passing into 'pimg.open()' and 'pimgtk.PhotoImage()'...

Into 'window_about.py' script, if i code as:
## Add an image logo
        print(f'{self.logo}')
        img = pimg.open(self.logo)
        icon = pimgtk.PhotoImage(img)
        img_service = ttk.Label(frm_service, image=icon)
        img_service.grid(row=0, column=0, rowspan=2)
the result is:
Error:
~/YUP.py/img/Logo.png Exception in Tkinter callback Traceback (most recent call last): File "/usr/local/lib/python3.6/tkinter/__init__.py", line 1699, in __call__ return self.func(*args) File "~/YUP.py/yup.tk.py", line 436, in about about = gui(None, init) File "~/YUP.py/modules/window_about.py", line 34, in __init__ self.initialize() File "~/YUP.py/modules/window_about.py", line 41, in initialize self.ui() File "~/YUP.py/modules/window_about.py", line 68, in ui img_service = ttk.Label(frm_service, image=icon) File "/usr/local/lib/python3.6/tkinter/ttk.py", line 761, in __init__ Widget.__init__(self, master, "ttk::label", kw) File "/usr/local/lib/python3.6/tkinter/ttk.py", line 559, in __init__ tkinter.Widget.__init__(self, master, widgetname, kw=kw) File "/usr/local/lib/python3.6/tkinter/__init__.py", line 2293, in __init__ (widgetName, self._w) + extra + self._options(cnf)) _tkinter.TclError: image "pyimage3" doesn't exist
Do you want a screenshot for my directory image?

i repeat: 'self.logo' is same image, into same directory, on first script 'yup.tk.py' and on 'window_about.py' - this second script is call by the first!
and 'self.logo' is passed to script 'window_about.py'...
Reply


Messages In This Thread
RE: image doesnt exists into personal module - by PyForIO - Mar-04-2018, 01:13 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020