ttk

python ttk treeview sort numbers

给你一囗甜甜゛ 提交于 2019-11-29 12:10:17
I'm trying to use the ttk.Treeview sort function illustrated in the answer to this question ( Tk treeview column sort ) and it works just fine for strings like 'abc', 'bcd', 'cde', etc., but when I try to sort numbers it ends up showing up like this: 1 10 11 2 3 ... I'd like for the data to be sorted such that the output is: 1 2 3 ... 10 11 I know that the values in the treeview columns are strings and that I'm most likely going to need to convert them to integers before sorting, but I can't figure out how to do that. list.sort method, sorted function accept optional key parameter. The return

How to change ttk.progressBar color in python

梦想的初衷 提交于 2019-11-29 04:44:13
Does anyone know how I can change the color of my ttk.progressBar? It now shows a green color, and I would love to have it blue. import ttk self.progressBar = ttk.Progressbar(frame3, length=560, maximum=100, mode='determinate'); self.progressBar.place(x=-5, y=60) you can change the color of a progressbar, but it is tricky. First, you need to understand that if you use the default theme, which is the default theme if you do not specify a theme in the tk.style. Then it will pass all the information it needs to the operating system, which will do the drawing using its style, disregarding style

How to make ttk.Treeview's rows editable?

放肆的年华 提交于 2019-11-29 04:37:36
Is there any way to use ttk Treeview with editable rows? I mean it should work more like a table. For example on double click on the item make the #0 column 'editable'. If this isn't possible, any way to allow mouse selecting on the item would be just fine. I haven't found any mention of this in tkdocs or other documents. After long research I haven't found such feature so I guess there's any. Tk is very simple interface, which allows programmer to build 'high-level' features from the basics. So my desired behaviour this way. def onDoubleClick(self, event): ''' Executed, when a row is double

Tkinter: ProgressBar with indeterminate duration

此生再无相见时 提交于 2019-11-29 02:42:57
I would like to implement a progress bar in Tkinter which fulfills the following requirements: The progress bar is the only element within the main window It can be started by a start command without the need of pressing any button It is able to wait until a task with unknown duration is finished The indicator of the progress bar keeps moving as long as the task is not finished It can be closed by a stop command without the need of pressing any stop bar So far, I have the following code: import Tkinter import ttk import time def task(root): root.mainloop() root = Tkinter.Tk() ft = ttk.Frame()

What is the difference between the widgets of tkinter and tkinter.ttk in Python?

↘锁芯ラ 提交于 2019-11-28 18:12:38
The main tkinter module and its submodule ttk in Python 3 appear to contain identical widgets (i.e. Buttons , CheckButtons , etc.). So, when creating a button, one has the freedom to either use a tkinter.Button widget or a tkinter.ttk.Button . Do you know what is the difference between them? Why would you choose one or the other? The widgets in tkinter are highly and easily configurable. You have almost complete control over how they look - border widths, fonts, images, colors, etc. ttk widgets use styles to define how they look, so it takes a bit more work if you want a non-standard button.

Fresh tutorial on tkinter and ttk for Python 3 [closed]

情到浓时终转凉″ 提交于 2019-11-28 15:38:44
Where can I find the most modern tutorial that teaches tkinter together with ttk ? Tkinter seems the only way to go in Python 3 (don't suggest Python 2), and ttk gave me hope for good-looking GUI. Todd I have found the TkDocs tutorial to be very useful. It describes building Tk interfaces using Python and Tkinter and ttk and makes notes about differences between Python 2 and 3. It also has examples in Perl, Ruby and Tcl, since the goal is to teach Tk itself, not the bindings for a particular language. I haven't gone through the whole thing from start to finish, rather have only used a number

How to disable manual resizing of Tkinter's Treeview column?

痴心易碎 提交于 2019-11-28 11:37:04
Since I can't horizontally scroll Treeview column due to what appears to be Tk/Tkinter limitation, I want to make it sticky so it is attached to the frame. The issue is that user can manually resize Treeview column which can mess up my interface in a certain way. Is it possible to disable such functionality? Note the size of the column header. User can drag mouse to resize column. I want to disable this. Setting minwidth to a certain value prevents column from shrinking, but it is still possible to resize it to a larger width. I suppose I can react to changing width and just revert it to

Tkinter Entry not showing the current value of textvariable

主宰稳场 提交于 2019-11-28 10:07:02
问题 Consider this code: from tkinter import * from tkinter.ttk import * tk=Tk() def sub(): var=StringVar(value='default value') def f(): pass Entry(tk,textvariable=var).pack() Button(tk,text='OK',command=f).pack() sub() mainloop() We expect the value of var appears in the entry, but actually it doesn't. The weird thing is that if I put the statement var.get() in the callback function of the button, the value of var will apear. Is that a bug caused by some kind of local variable optimization in

Horizontal scrolling won't activate for ttk Treeview widget

蹲街弑〆低调 提交于 2019-11-28 09:17:13
I'm using the ttk Treeview widget to implement a folder/path selection dialog. It's all working as expected except that my horizontal scrollbar won't activate. No matter how wide the folder path goes horizontally, and no matter how narrow the window, the horizontal slider never appears. Vertical scrolling is working perfectly though. I'm figuring it's either some kind of limitation when you only use one column in the treeview, or just a newbie mistake with configuring and connecting the widgets. I'd bet on the latter. Example with dialog widened to show full folder depth: Dialog narrowed to

Removing Ttk Notebook Tab Dashed Line

余生长醉 提交于 2019-11-28 07:44:43
问题 I'm trying to make a tkinter app that doesn't look like a tkinter app. I'm using a ttk Notebook, and the tabs have this little dotted line around the text when they're selected. It looks terrible, and I can't find a way to remove it using either styles or config. Here's a screenshot to clarify: Edit for code (I don't think it'll be terribly helpful, since I'm actually just trying to remove a default style thing.): Here is the notebook creation: tabs = ttk.Notebook(mainframe, width=319, height