So my objective is to create a simple software that can open some websites (using the webbrowser module). I created the first window (Here the MainWin class), that displays the title (Website Access) and a big button containing an image, that leads to the second window (SecWin class). In the SecWin window, I want two buttons, one on the right, in the frame 'right', and one on the left, in the 'left' frame. In each of these button I put an image (vidim and gooim). And then, I get this thing:
The buttons are completely blank
Moreover, the buttons don't work, and the problem doesn't come from the function assigned to the buttons because they work very well if I try to replace the images in them by a text.
I'm lost because the button on the main windows works well, so I don't know where the problem comes from.
class Win:
def __init__(self):
self.win = Tk()
self.win.title("Website Access")
self.win.geometry('256x128')
self.win.minsize = (256, 128)
self.win.maxsize = (256, 128)
self.win.config(bg='#D9D9D9')
class MainWin(Win):
def __init__(self):
super().__init__() #generates the size, color, title, ... of the window
self.create_frame()
self.create_main()
self.create_title()
self.packing()
self.win.mainloop()
def create_frame(self):
self.frame = Frame(self.win, bg='#D9D9D9')
def create_main(self):
self.image = PhotoImage(file='Assets/Web.png').zoom(10).subsample(64)
self.but = Button(self.frame, image=self.image, bd=5, relief=RAISED, command=Functions.main_win_button)
self.but.pack()
def create_title(self):
self.title = Label(self.frame, text='Welcome to Website access', font=('Courier', 15), bg='#C9C9C9',
fg='#000000', bd=3, relief=SUNKEN)
self.title.pack()
def packing(self):
self.frame.pack(expand=YES)
class SecWin(Win):
def __init__(self):
super().__init__()
self.create_frames()
self.create_images()
self.create_buttons()
self.packing()
def create_frames(self):
self.left = Frame(self.win, bg='#D9D9D9')
self.right = Frame(self.win, bg='#D9D9D9')
def create_images(self):
self.vidim = PhotoImage(master=self.win, file='Assets/Videos.png')
self.gooim = PhotoImage(master=self.win, file='Assets/Google.png')
def create_buttons(self):
self.videos = Button(self.left, image=self.vidim, bd=5, relief=RAISED,command=Functions.temp)
self.google = Button(self.right, image=self.gooim, bd=5, relief=RAISED,command=Functions.temp)
def packing(self):
self.videos.pack(expand=YES)
self.google.pack(expand=YES)
self.right.pack(side=RIGHT)
self.left.pack(side=LEFT)