We can create our GUI inside a method of a class. lumnconfigure(1, minsize=800, weight=1)įr_buttons = tk.Frame(window, relief=tk.RAISED, bd=2)ītn_open = tk.Button(fr_buttons, text="Open", command=open_file)ītn_save = tk.Button(fr_buttons, text="Save As.", command=save_file)ītn_id(row=0, column=0, sticky="ew", padx=5, pady=5)ītn_id(row=1, column=0, sticky="ew", padx=5)įr_id(row=0, column=0, sticky="ns") Window.rowconfigure(0, minsize=800, weight=1) Here the code (without my attempt at doing the dark-mode): import tkinter as tkįrom tkinter.filedialog import askopenfilename, asksaveasfilenameįiletypes= For example, if it was: frame = tk.Frame(colour=white)Īs the default, in the function I would put: frame = tk.Frame(colour=white)Įven to me, this didn't look right. I tried binding a function the checkbutton where it would check the state and depending on the state, change the variables of the frames in the window. What I wanted to do was add the option of using a checkbutton, so when checked, the theme of the text-editor would change to dark-mode theme and when unchecked, would return to the default white theme. I followed this tutorial in creating a very simple text-editor app using Python's Tkinter.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |