ttk

Switching values of tk.call() and ttk.Style().theme_use()

Switching values of tk.call() and ttk.Style().theme_use() Question: I have the following function that supposed to switch the theme of my GUI, but I’m dealing with a small issue. The theme switches the first time CheckButton pressed. But trying it again getting the following errors: _tkinter.TclError: Theme forest-light already exists and: _tkinter.TclError: Theme forest-dark already exists …

Total answers: 1

Combobox not displaying (Tkinter)

Combobox not displaying (Tkinter) Question: Im trying to use a combobox in my program. To simplify my program, my main window uses an image as a background, and my buttons and entry boxes I wont include since they arent relavent. The code for my main window is: from tkinter.ttk import Combobox from tkinter.ttk import * …

Total answers: 1

How to add different background colors to different selection options in ttk.Combobox?

How to add different background colors to different selection options in ttk.Combobox? Question: I want to add different colors to different selections in Combobox. I found questions about changing the overall background color, but not per entry. I’m attaching some examples below. Asked By: Mike Azatov || Source Answers: The Ttk Combobox does not supports …

Total answers: 1

How to create a subclass of ttk.Button correctly (class function doesnt work)?

How to create a subclass of ttk.Button correctly (class function doesnt work)? Question: I want to create Buttons with a text and define a function that prints me the text on the monitor when i press the button. Everything works well without classes: from tkinter import * from tkinter import ttk def PressButton(): print(FirstButton.cget(‘text’)) root …

Total answers: 1

Why can't change ttk.Entry background color?

Why can't change ttk.Entry background color? Question: Here is a code simple to illustrate my problem : import tkinter as tk import tkinter.ttk as ttk root = tk.Tk() root.geometry(‘300×300’) s = ttk.Style(root) s.configure( ‘TEntry’, background=’blue’, foreground=’red’ ) s.map( ‘TEntry’, foreground=[(‘focus’, ‘pink’)], background=[(‘focus’, ‘green’)] ) Entry = ttk.Entry(root) Entry.pack() root.mainloop() No matter what I do the …

Total answers: 1

Sub Frame Is Not Expanded When Its Parent Is

Sub Frame Is Not Expanded When Its Parent Is Question: import tkinter as tk import tkinter.ttk as ttk root = tk.Tk() left_frame_1 = tk.Frame(root, background="#ff0000") left_frame_1.grid(row=0, column=0) left_frame_2 = tk.Frame(left_frame_1) left_frame_2.grid(row=0, column=0) left_label_1 = tk.Label(left_frame_2, text="HELLO") left_label_2 = tk.Label(left_frame_2, text="WORLD") left_label_3 = tk.Label(left_frame_2, text="=D") left_label_1.grid(row=0, column=0) left_label_2.grid(row=1, column=0) left_label_3.grid(row=2, column=0) right_frame1 = tk.Frame(root, background="#00ff00") right_frame1.grid(row=0, …

Total answers: 1

Callback timing with ttk treeview (handling user treeview interaction)

Callback timing with ttk treeview (handling user treeview interaction) Question: Update: this question has been answered, at the bottom is the summary! I have a ttk treeview populated with items, I have some buttons next to the treeview, and the state of those buttons is determined by what is highlighted within the treeview (for example, …

Total answers: 1

ttk.Labelframe color issue

ttk.Labelframe color issue Question: I am coding a bit of a GUI using tkinter in Python, using ttk items such as the notebook, treeview, and labelframes (and a lot of other things too) everything I was doing looked great, until I changed the color from the "system color" of beige, to white. Here’s an (updated!) …

Total answers: 1

How do I change a Checkbuttons state in TTK?

How do I change a Checkbuttons state in TTK? Question: I’m creating a list of Checkbuttons which highlight when selected, when another Checkbutton is selected I want to deselect the other buttons, I have two buttons in my code when my button ‘create booking’ is toggled on or off it calls clear_previous_selection. Here I try …

Total answers: 2

TKinter weird behavior using grid location manager with arguments row=0, column=0

TKinter weird behavior using grid location manager with arguments row=0, column=0 Question: I’m using two frames to organize my main frame into two subframes. One subframe is one the left and it contains a few buttons and a label. The subframe on the right contains a treeview. The items in the left_frame don’t show up …

Total answers: 1