ttk

How to edit the style of a heading in Treeview (Python ttk)

主宰稳场 提交于 2019-12-06 22:52:33
问题 I am trying to use ttk.Treeview to make a sortable table (as per Does tkinter have a table widget? and https://www.daniweb.com/software-development/python/threads/350266/creating-table-in-python). Getting it to work is easy, but I'm having some issues with the styling. The default style for the Treeview heading is black text on a white background, which is fine. However, in my code I'm using: ttk.Style().configure(".", font=('Helvetica', 8), foreground="white") to format my GUI. This

Python: ttk: disable/enable a button

陌路散爱 提交于 2019-12-06 22:34:02
问题 I want to change ttk.Button's state according to some internal logic. I create a button and associate a style with it: cardBtnStyle = ttk.Style() cardBtnStyle.configure('CB.TButton') cardBtn = ttk.Button(top, text="Make SD card", style='CB.TButton', command = cardCreateCallBack).grid(column=1, row=5) Following statement has no effect: style.configure('CB.TButton', state='disabled') But when I create a button like this, it is disabled: cardBtn = ttk.Button(top, text="Make SD card", style='CB

Python tkinter Combobox

烂漫一生 提交于 2019-12-06 21:44:39
I want to fill my entries when I click in a name of my Combobox without buttons like 'check' to show the values. How can i do that? import tkinter as tk from tkinter import ttk import csv root = tk.Tk() cb = ttk.Combobox(root,state='readonly') labName = ttk.Label(root,text='Names: ') labTel = ttk.Label(root,text='TelNum:') labCity = ttk.Label(root,text='City: ') entTel = ttk.Entry(root,state='readonly') entCity = ttk.Entry(root,state='readonly') with open('file.csv','r',newline='') as file: reader = csv.reader(file,delimiter='\t') cb.grid(row=0,column=1) labName.grid(row=0,column=0) labTel

How to control the tkinter combobox selection highlighting

前提是你 提交于 2019-12-06 20:59:45
问题 I wrote a small farad converter to learn GUI programming. It works great, looks fine-ish. The only problem is I can't seem to figure out how to control this strange highlighting that comes up on my ttk.Combobox selections. I did use a ttk.Style() , but it only changed the colors of the ttk.Combobox background, entries, etc. I also tried changing openbox/gtk themes. I'm talking about what's seen there on the text "microfarads (uF)". It'd be fine, if it highlighted the entire box; but I'd

can't set background color ttk python os x using styles

元气小坏坏 提交于 2019-12-06 15:51:44
With this code fragment, I would expect the label to have a background color red. def createWidgets(self): style = ttk.Style() style.configure("Red.TLabel", foreground="green", background="red") self.label1 = ttk.Label(textvariable=self.numberArray[0][0],style="Red.TLabel") self.label1.pack() I get the green foreground color but I can't change the background color. This is on OS X. I'm using ActiveState's tcl and python. The same problem occurs with Python 3.2 and 2.7 You'll sometimes try to change an option that is supposed to exist according to element options, but it will have no effect. As

Python Tkinter ttk calendar

拥有回忆 提交于 2019-12-06 06:59:06
I am trying to create a drop down calendar for a date entry. Below is a portion of my code: The drop down portion of it dosen't work and I can't seem to find the syntax for DateEntry() of ttk calendar anywhere to include the calendar widget option! #creating the frame from tkinter import * from tkcalendar import * root = Tk() f1=Frame(root,width=1500,height=100,relief=SUNKEN,bd=4,bg='light steel blue') f1.pack(side=TOP) f2=Frame(root,width=1500,height=550,relief=SUNKEN,bd=4,bg='white') f2.pack() f3=Frame(root,width=1600,height=100,relief=SUNKEN,bd=4,bg='white') f3.pack(side=BOTTOM) #Creating

On-value-change type of event for widgets or use .trace_variable() technique?

夙愿已清 提交于 2019-12-06 06:45:51
Is there an on-value-change type of event for data input widgets like Entry, Text, Spinner, Checkbutton, Radiobutton? By on-value-change, I mean the ability to detect when the value of a widget has changed due to keyboard input or cut/delete/paste (and Text edit_undo/edit_redo) activity? I see no such event described in the Tkinter event documentation [1]. Is the proper technique to link Tkinter variables to widget values I want to monitor and use these variables' .trace_variable( 'w', ... ) methods to bind to value changes? This seems like the right approach, but I haven't seen a lot of trace

How to retrieve the integer value of tkinter ttk Scale widget in Python?

拈花ヽ惹草 提交于 2019-12-06 06:19:34
Could anyone advise how to retrieve and update a Label widget with the value from a Scale widget in Python? Currently it shows a very large real number. I have tried to type cast the value but this only works when I print to idle. I tried slider.get() but the label is blank. Also tried int(slider.get()) which works when I print to idle. from tkinter import * from tkinter import ttk root = Tk() root.title("Playing with Scales") mainframe = ttk.Frame(root, padding="24 24 24 24") mainframe.grid(column=0, row=0, sticky=(N, W, E, S)) slider = IntVar() ttk.Scale(mainframe, from_=0, to_=100, length

R with tcltk/tcltk2: Improve slow performance when displaying big data.frame with TkTable?

情到浓时终转凉″ 提交于 2019-12-06 06:09:24
Please see two edits below (added later)... I have loaded a big data.frame into memory ( 2.7 mio rows and 7 columns - 74 MB of RAM ). If I want to view the data using Tcl/Tk's Tktable widget via the tcltk2 package function tk2edit it takes over 15 minutes till the window is displayed with the data and about 7 GB of RAM (!) is consumed by R (incl. Tcl/Tk) en plus! Example: library(tcltk2) my.data.frame <- data.frame(ID=1:2600000, col1=rep(LETTERS,100000), col2=rep(letters,1E5), col3=26E5:1) # about 40 MB of data tk2edit(my.data.frame) The basic problem seems to be that each cell of the data

ttk: how to make a frame look like a labelframe?

我是研究僧i 提交于 2019-12-06 05:06:51
问题 Python ttk gui creating is easy and has mostly native look and feel (win7). I am having a slight problem, though: I would like to have a frame that looks like ttk.LabelFrame but without label. Just omitting the text option will leave an ugly gap. Also I can not get the ttk.Frame border to look like LabelFrame. Is there an elegant way of doing this? Bonus karma if this works on all/most windows versions above xp. Maybe it works with styles but the style LabelFrame properties seem mostly empty