ttk

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

谁说胖子不能爱 提交于 2019-11-27 05:03:53
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . 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. 回答1: I have found the TkDocs tutorial to be very useful. It describes building Tk interfaces using Python and Tkinter

Horizontal scrolling won't activate for ttk Treeview widget

微笑、不失礼 提交于 2019-11-27 02:48:15
问题 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

How to create a tree view with checkboxes in Python

我是研究僧i 提交于 2019-11-27 01:58:38
I've been using Tkinter and Tix to write a small program. I'm at a point where I need a tree view with checkboxes (checkbuttons) so I can select items from the tree view. Is there an easy way to do this? I've been looking at ttk.Treeview () and it looks easy to get the tree view but is there a way to insert a checkbutton to the view? A simple code snippet would be really appreciated. I'm not limited to ttk. Anything will do; as long as I have an example or good docs I can make it work import Tix class View(object): def __init__(self, root): self.root = root self.makeCheckList() def

ttk treeview: alternate row colors

怎甘沉沦 提交于 2019-11-27 01:55:24
问题 How can I set a style for treeview widgets so that alternate rows have different background colors, for example, rows 1,3,5 have white backgrounds and rows 2,4,6 have light blue-grey backgrounds? I'd also like to set gridlines . 回答1: I had this same issue a few months ago. From the tk docs: You can assign a list of tags to each item using the "tags" item configuration option (again, when creating the item or later on). Tag configuration options can then be specified, which will then apply to

tkinter optionmenu first option vanishes

前提是你 提交于 2019-11-27 01:23:04
问题 A ttk optionmenu widget starts out with all of its values in the dropdown. Upon selecting any value, the first value in the list vanishes, never to reappear... Does anyone know why? Is this a feature of the widget's design? Try it with the following: import tkinter.ttk as ttk import tkinter as tk a = tk.Tk() options = ['1', '2', '3'] value = tk.StringVar() masterframe = ttk.Frame() masterframe.pack() dropdown = ttk.OptionMenu(masterframe, value, *options) dropdown.pack() a.mainloop() Note -

Change color of “tab header” in ttk.Notebook

拜拜、爱过 提交于 2019-11-26 23:30:10
问题 Gretings! I want to change the color displayed in a tab header, created using ttk.Notebook. After search for a while I've found that to change the style of ttk widgets, we can use ttk. Styling, because Notebook apparently do not have configuration options to change its colors. However, I only found how to change the background and the foreground of a NoteBook object, but not how to configure the "tab header", whose background is either white (when selected) or grey (when not selected).

Matplotlib Crashing tkinter Application

痞子三分冷 提交于 2019-11-26 13:03:30
问题 I am building an application that embeds a matplotlib figure into the GUI. The problem is that my app is crashing as soon as I add anything from matplotlib into my code (except for the imports, those work as usual). The problem occurs in my class Solver_App at tk.Tk.__init__(self, *args, **kwargs) . When I run the code, I get a massive error and the app crashes. Here is some of my code: import tkinter as tk from tkinter import ttk import matplotlib from matplotlib import pyplot as plt from

How to create a tree view with checkboxes in Python

烂漫一生 提交于 2019-11-26 12:29:50
问题 I\'ve been using Tkinter and Tix to write a small program. I\'m at a point where I need a tree view with checkboxes (checkbuttons) so I can select items from the tree view. Is there an easy way to do this? I\'ve been looking at ttk.Treeview () and it looks easy to get the tree view but is there a way to insert a checkbutton to the view? A simple code snippet would be really appreciated. I\'m not limited to ttk. Anything will do; as long as I have an example or good docs I can make it work 回答1

How to create downloading progress bar in ttk?

微笑、不失礼 提交于 2019-11-26 04:43:52
问题 I want to show a progress bar while downloading a file from the web using the urllib.urlretrive method. How do I use the ttk.Progressbar to do this task? Here is what I have done so far: from tkinter import ttk from tkinter import * root = Tk() pb = ttk.Progressbar(root, orient=\"horizontal\", length=200, mode=\"determinate\") pb.pack() pb.start() root.mainloop() But it just keeps looping. 回答1: For determinate mode you do not want to call start . Instead, simply configure the value of the