I try find solution in google but all solution in google not work for me maybe here I get The correct answer.
I have this code:
from tkinter import *
class gui_main:
def __init__(self):
self.win_about = Tk() #creat new windows
self.win_about.title("About software") # Get title to new windows -> "About software"
self.win_about.geometry("400x120+600+200") # Get size to window
self.win_about.resizable(width=False, height=False) # Off option Increase / decrease window
lab = Label(self.win_about, text="""
welcome to app
For Enter to app click on button Next.
""", justify='center') # Create new text in the window
lab.place(x=-18, y=-11) # Position of text in window (x - up/down , y - left/right)
btn_next = Button(self.win_about, text="Next", fg="red", command=gui_main.screen_menu()) # Create new button
btn_next.place(x=350, y=90) # Position of button in window (x - up/down , y - left/right)
btn_exit = Button(self.win_about, text="Exit", fg="red", command=self.win_about.destroy) # Create new button
btn_exit.place(x=10, y=90) # Position of button in window (x - up/down , y - left/right)
self.win_about.mainloop() # Run the cod in loop
def screen_menu(self):
self.win_menu = Tk()
self.win_menu.title("Menu")
self.win_menu.geometry("500x500+400+400")
self.win_about.destroy()
self.win_menu.mainloop()
if __name__ == "__main__":
g = gui_main()
g.win_about()
And I get this Error:
Traceback (most recent call last): File "location file", line 42, in g = gui_main() File "location file", line 26, in init btn_next = Button(self.win_about, text="Next", fg="red", command=gui_main.screen_menu()) # Create new button TypeError: screen_menu() missing 1 required positional argument: 'self'
Ty for help, I will hope find any solution
Tk()
as well. - acw1668command
is specified for each of the twoButton
s. Notice anything different? - Karl Knechtel