ttk

Disabling tkinter ttk scale widget

﹥>﹥吖頭↗ 提交于 2020-04-03 07:08:43
问题 I am trying to disable all of the (ttk) widgets in a frame, but it appears that the scale widget is giving me some trouble, as it throws the following exception: _tkinter.TclError: unknown option "-state" Some relevant code: import tkinter as tk from tkinter import ttk def disable_widgets(parent): for child in parent.winfo_children(): child.config(state = 'disabled') root = tk.Tk() # Frame full of widgets to toggle frame_of_widgets = ttk.Frame(root) frame_of_widgets.pack() # Button to be

Disabling tkinter ttk scale widget

倖福魔咒の 提交于 2020-04-03 07:04:20
问题 I am trying to disable all of the (ttk) widgets in a frame, but it appears that the scale widget is giving me some trouble, as it throws the following exception: _tkinter.TclError: unknown option "-state" Some relevant code: import tkinter as tk from tkinter import ttk def disable_widgets(parent): for child in parent.winfo_children(): child.config(state = 'disabled') root = tk.Tk() # Frame full of widgets to toggle frame_of_widgets = ttk.Frame(root) frame_of_widgets.pack() # Button to be

Create custom ttk style same as 'clam' ttk Theme (button widget specific)

强颜欢笑 提交于 2020-03-20 03:45:17
问题 I need to create a custom style for button widgets which has the same appearance as buttons using the ttk 'clam' theme. I can set the theme like: s = ttk.Style() s.theme_use('clam') However, given the nature of a theme, this will then set all ttk widgets to use 'clam'. I would like to be able to set certain ttk buttons to use the clam appearance and others to use default ttk. I have tried looking at the layouts and configurations of 'TButton' whilst the clam theme is in use but it seems that

Create custom ttk style same as 'clam' ttk Theme (button widget specific)

╄→гoц情女王★ 提交于 2020-03-20 03:43:30
问题 I need to create a custom style for button widgets which has the same appearance as buttons using the ttk 'clam' theme. I can set the theme like: s = ttk.Style() s.theme_use('clam') However, given the nature of a theme, this will then set all ttk widgets to use 'clam'. I would like to be able to set certain ttk buttons to use the clam appearance and others to use default ttk. I have tried looking at the layouts and configurations of 'TButton' whilst the clam theme is in use but it seems that

Create custom ttk style same as 'clam' ttk Theme (button widget specific)

╄→尐↘猪︶ㄣ 提交于 2020-03-20 03:42:28
问题 I need to create a custom style for button widgets which has the same appearance as buttons using the ttk 'clam' theme. I can set the theme like: s = ttk.Style() s.theme_use('clam') However, given the nature of a theme, this will then set all ttk widgets to use 'clam'. I would like to be able to set certain ttk buttons to use the clam appearance and others to use default ttk. I have tried looking at the layouts and configurations of 'TButton' whilst the clam theme is in use but it seems that

Expand/collapse ttk Treeview branch

淺唱寂寞╮ 提交于 2020-02-22 04:21:57
问题 I would like to know the command for collapsing and expanding a branch in ttk.Treeview. Here is a minimalistic example code: #! coding=utf-8 import tkinter as tk from tkinter import ttk root = tk.Tk() tree = ttk.Treeview(root) tree.pack(fill=tk.BOTH,expand=True) tree.insert("", index="end",iid="Main", text="main branch") tree.insert("Main", index="end", text="Stuff 1") tree.insert("Main", index="end", text="Stuff 2") root.mainloop() What command opens and/or expands the "main branch"? There

Expand/collapse ttk Treeview branch

隐身守侯 提交于 2020-02-22 04:21:51
问题 I would like to know the command for collapsing and expanding a branch in ttk.Treeview. Here is a minimalistic example code: #! coding=utf-8 import tkinter as tk from tkinter import ttk root = tk.Tk() tree = ttk.Treeview(root) tree.pack(fill=tk.BOTH,expand=True) tree.insert("", index="end",iid="Main", text="main branch") tree.insert("Main", index="end", text="Stuff 1") tree.insert("Main", index="end", text="Stuff 2") root.mainloop() What command opens and/or expands the "main branch"? There

Expand/collapse ttk Treeview branch

北慕城南 提交于 2020-02-22 04:21:14
问题 I would like to know the command for collapsing and expanding a branch in ttk.Treeview. Here is a minimalistic example code: #! coding=utf-8 import tkinter as tk from tkinter import ttk root = tk.Tk() tree = ttk.Treeview(root) tree.pack(fill=tk.BOTH,expand=True) tree.insert("", index="end",iid="Main", text="main branch") tree.insert("Main", index="end", text="Stuff 1") tree.insert("Main", index="end", text="Stuff 2") root.mainloop() What command opens and/or expands the "main branch"? There

How to fully change the background color on a tkinter.ttk Treeview

风格不统一 提交于 2020-02-03 05:49:53
问题 I have been attempting to make a directory browser for a recent project of mine that I'm developing in python 3.4.4 with tkinter. I do not want the background to be the default color, so I have gone about changing the background of most widgets. I didn't have any trouble until I got to the Treeview. I'm not too good with ttk.Style(), but I still managed to get ttk.Style().configure("Treeview", background="black", foreground="white") to work, however this only changes the background of the

ttk Entry widget ignores font applied via style?

不羁的心 提交于 2020-01-30 08:28:25
问题 from tkinter import Tk from tkinter.ttk import Style, Entry import tkinter.font as tkfont root = Tk() font = tkfont.Font(family='Helvetica', size=30, slant='italic') style = Style() style.configure('Custom.TEntry', font=font, foreground='green') entry_font = Entry(root, font=font, foreground='green') entry_font.insert(0, 'directly configured') entry_font.pack() entry_style = Entry(root, style='Custom.TEntry') entry_style.insert(0, 'styled entry') entry_style.pack() root.mainloop() The first