Category : tkinter

I need to make the button save the path to its application. That is, I bind, say, a shortcut to a button, everything works, but if I restart, everything needs to be done again. Please tell me how to implement saving? my code: import tkinter.filedialog as tfd import tkinter as tk import os window = ..

Read more

I have this function that launch an exe file def output(file, input_par): file = fd.askopenfile() var1 = ‘1n25n19n0.8n2n0.1n3n60n3’ p = Popen([file.name, ‘f’], stdout=PIPE, stdin=PIPE, stderr=PIPE, encoding="UTF8") lst = p.communicate(input=var1)[0].splitlines() lst = list(dropwhile(lambda el: el.strip() != ‘MODEL DATA:’, lst)) return lst I have this button def openfile(): return filedialog.askopenfilename() button = ttk.Button(button_frame, text="Open", command=openfile) # <—— ..

Read more

Can anyone help me out delete one notebook tab and then reload it. I have this that destroy the tab but cant seem to reload it after. Why is it not reloading? from formularios import tabControlmain for item in tabControlmain.winfo_children(): if str(item) == (tabControlmain.select()): item.destroy() # this destroys tabmain1 return tabmain1 = ttk.Frame(tabControlmain)# creates tabmain1 ..

Read more

I want to add a text field and input text if the user choose "Yes" in the combo box; other wise nothing will be added. Tried this but didn’t work Combo = ttk.Combobox(window, values = vlist) Combo.set("Pick an Option") Combo.pack() if (Combo.get()=="Yes"): tkinter.Label(window, text="Number of Workers", bg = "white",fg = "black", font=("Times",13,"bold")).place(x=155,y=240) inputtxt3 = Text(window, ..

Read more

So, that’s one of the strangest errors I’ve ever seen in Python. Hopefully, you can help me. I have a tkinter mainwindow in main_file implementing images via: from PIL import Image, ImageTk, ImageColor #… self.image_package_render = Image.open(‘ImagePackage.png’) self.image_package_render_data = np.array(self.image_package_render.convert(‘RGBA’)) self.plus_render = ImageTk.PhotoImage(self.image_package_render.resize((14, 14), box=(16, 20, 30, 34))) When I launch the main_file directly, it ..

Read more

I would like to define button color when disabled. Currently, I change the color of the button every time I change the button state. button.config(state=DISABLED, bg="grey") And then I need to change it back every time. Which is quite annoying. button.config(state=NORMAL, bg="red") There is an option for foreground disabledforeground so I expected there is a ..

Read more