Category : tkinter

I’m not creating another Tk instance. The code I provided here is the entire program except the import statements. I have this function: def addCanvas(path, canvasWidth, canvasHeight): print(path) root = Tk() c = Canvas(root, width=canvasWidth, height=canvasHeight) c.pack() # img = ImageTk.PhotoImage(Image.open(r"imagepathimagename.extension")) img = ImageTk.PhotoImage(Image.open(path)) c.create_image(0, 0, image=img, anchor=NW) return img I call it this way: ..

Read more

So, I have this code, main.py: from tkinter import Tk from tkinter import Frame class MainWindow(): def __init__(self, master): self.master = master sw = self.master.winfo_screenwidth() sh = self.master.winfo_screenheight() w = 900 h = 600 x = (sw/2) – (w/2) y = (sh/2) – (h/2) self.master.geometry(‘%dx%d+%d+%d’ % (w, h, x, y)) self.master.resizable(False, False) #this part self.titleFrame ..

Read more

I cannot remember how to install tkinter modules. I remember doing it before for Tkinter calendar but it took me a long time to figure out and now I have forgotten. I cannot just type pip install ttkthemes because it says ‘pip’ is not recognized as an internal or external command, operable program or batch ..

Read more

I’m currently working on a large tkinter GUI project and it’s starting to get really overwhelming! I’ve got tons of code that looks identical but with small differences and it’s getting hard to stay organized an efficient when trying to add new things and fix old things. So I’ve got a few questions about how ..

Read more