Dec-15-2022, 10:14 AM
Hello,
I'm working on python to discover the 1 and other after a simple course. I have found a script that I have partly incorporated into my own future script. Now this script only gives 2 warnings that I want out. Can someone help me?
Warnings
Line 29 : Too few arguments for "create_window" or "Canvas"
Line 29 : Argument 1 to "create_window" of "Canvas" has incompatible type "Tuple[int, int]"; expected "float"
I'm working on python to discover the 1 and other after a simple course. I have found a script that I have partly incorporated into my own future script. Now this script only gives 2 warnings that I want out. Can someone help me?
Warnings
Line 29 : Too few arguments for "create_window" or "Canvas"
Line 29 : Argument 1 to "create_window" of "Canvas" has incompatible type "Tuple[int, int]"; expected "float"
from tkinter import * from tkinter import ttk root = Tk() root.title('Learn To Code at Codemy.com') root.iconbitmap('c:/gui/codemy.ico') root.geometry("500x400") # Create A Main Frame main_frame = Frame(root) main_frame.pack(fill=BOTH, expand=1) # Create A Canvas my_canvas = Canvas(main_frame) my_canvas.pack(side=LEFT, fill=BOTH, expand=1) # Add A Scrollbar To The Canvas my_scrollbar = ttk.Scrollbar(main_frame, orient=VERTICAL, command=my_canvas.yview) my_scrollbar.pack(side=RIGHT, fill=Y) # Configure The Canvas my_canvas.configure(yscrollcommand=my_scrollbar.set) my_canvas.bind('<Configure>', lambda e: my_canvas.configure(scrollregion = my_canvas.bbox("all"))) # Create ANOTHER Frame INSIDE the Canvas second_frame = Frame(my_canvas) # Add that New frame To a Window In The Canvas my_canvas.create_window((0,0), window=second_frame, anchor="nw") for thing in range(100): Button(second_frame, text=f'Button {thing} Yo!').grid(row=thing, column=0, pady=10, padx=10) Label(second_frame, text="It's Friday Yo!").grid(row=3, column=2) root.mainloop()