0

I am writing code using Python and Tkinter. I have two windows in the program: root and install

In both windows I use tabs (notebook and Frame) Everything is fine with the root window - png icons appear, but I have problems with the install window - the tabs themselves are created, but without icons.

The install window is in a function because I call it with a button. Here is the function code

def howinstall():
        
        install = Tk()
        install.title('Install guide')
        install.iconbitmap('app.ico')
        install.resizable(False, False)
        install.geometry('500x720')

        LinuxIcon = PhotoImage(file='./perfectsystem.png')
        WindassIcon = PhotoImage(file='./shitsystem.png')
        
        installnotebook = ttk.Notebook(install)
        installnotebook.pack(expand=True, fill='both')
        
        installWindass = ttk.Frame(installnotebook)
        installLinux = ttk.Frame(installnotebook)

        installWindass.pack(fill='both', expand=True)
        installLinux.pack(fill='both', expand=True)

        installnotebook.add(installWindass, text='Windows', image=WindassIcon, compound=LEFT)
        installnotebook.add(installLinux, text='Linux', image=LinuxIcon, compound=LEFT)
  1. I tried to define icons at the beginning of the main code (where I define all the images in the code), I tried to define them in the function itself - no result
  2. There are no problems with files - I wrote test code, with function code, and also used these icons in the root window - everything is fine with them
  • file='./perfectsystem.png' should be file='perfectsystem.png' Same as other. – toyota Supra Aug 17 '23 at 18:42
  • 1
    Also, it sounds like you may have called `Tk()` more than once, which causes various problems (including missing images). Use `Toplevel()` instead to create additional windows. – jasonharper Aug 17 '23 at 18:55

0 Answers0