ttk

tkinter ttk Entry widget -disabledforeground

别等时光非礼了梦想. 提交于 2019-12-13 19:17:12
问题 I was trying to change the color of the words in my ttk.Entr widget when I set the state to disabled , I looked up the manual, there's an option called disabledforeground , so I wrote a test snippet as below: (BTW, I'm under Python 2.7) from Tkinter import * from ttk import * root=Tk() style=Style() style.configure("TEntry",disabledforeground='red') entry_var=StringVar() entry=Entry(root,textvariable=entry_var,state='disabled') entry.pack() entry_var.set('test') mainloop() But the result

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

爱⌒轻易说出口 提交于 2019-12-13 12:33:50
问题 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', ... )

Refreshing code in Tkinter window with button

邮差的信 提交于 2019-12-13 04:50:44
问题 I'm 99% this isn't possible since python is first byte compiled then probably opens the Tk windows, but I'm wondering if there is any circumstance to add a button to refresh your tk app in place after you save the app its actually written in? You can imagine after updating padding or some minor attribute it would be so cool to just hit the button to refresh the frame instead of closing and starting a new instance. something... class myapp() def __init___(self,root): self.root = root main_menu

Select multiple entries in Tkinter treeview without pressing ctrl key

若如初见. 提交于 2019-12-13 03:15:45
问题 I am trying to select multiple entries from Tkinter treeview. I used selectmode = extended for the same(use ctrl+enter key). But as soon as I try to open new branch in the tree(ctrl pressed), I am not able to open and if I do the same without pressing ctrl my selections from branch 1 disappears. Hence, I am trying to get some other way for selecting multiple nodes from Tkinter tree (from different brances) without pressing ctrl key. (i.e either remembering my mouse selections or some checkbox

Tkinter Toplevel widgets not displaying - python

我的未来我决定 提交于 2019-12-13 02:19:56
问题 I am working with a Toplevel window in python Tkinter and I cannot seem to get the embedded widgets to show up until my other code has completed. The frame shows up, it loops through my other code properly, but the text/progressbar widget only show up if I somehow interrupt the loop. The frame is successfully destroyed at the end. See below. Here is my Toplevel code: class ProgressTrack: def __init__(self, master, variable, steps, application): self.progress_frame = Toplevel(master) self

Tkinter Treeview selection

半城伤御伤魂 提交于 2019-12-12 23:47:23
问题 from Tkinter import * from ttk import * import tkMessageBox class Application(Frame) : def selected(self): curItem = self.tree.focus(); print self.tree.item(curItem)['values'][0] self.quit() def __init__(self,master = None): Frame.__init__(self, master) self.grid() tree = self.tree = Treeview(self,columns=('Name','Description'),show="headings",selectmode='browse') tree.heading("Name", text="Name") tree.heading("Description", text="Description") tree.grid(padx = 30) i = tree.insert('','end'

How to create arrow in a tkinter.ttk.Button and control it's size?

ε祈祈猫儿з 提交于 2019-12-12 18:39:32
问题 I would like to create ttk.button with an arrow in it and have the arrow size changable. I discovered 'TButton' inherently contains StyleNames TButton.leftarrow which is not exposed by the ttk.Style().layout(). Questions: (1) How do I activate these StyleNames? (2) How do I control the size of .leftarrow ? I notice it has a arrowsize option . How do I use it? import tkinter as tk import tkinter.ttk as ttk class App(ttk.Frame): def __init__(self, parent): ttk.Frame.__init__(self, parent) self

How to make ttk.Scale behave more like tk.Scale?

馋奶兔 提交于 2019-12-12 12:08:40
问题 Several Tk widgets also exist in Ttk versions. Usually they have the same general behaviour, but use "styles" and "themes" rather than per-instance appearance attributes (such as bg , etc...). This is good, as the Ttk widgets take the "standard appearance" of the OS's window manager by default, without needing to configure anything about appearance. However, for some reason the ttk.Scale widget does not have two very useful options of the tk.Scale widget: showvalue and tickinterval (see

Calling a Tk instance from another Tk instance causes issue setting textvariables

∥☆過路亽.° 提交于 2019-12-12 06:19:55
问题 I have built a simple user dropdown menu using Tkinter and ttk . I use textvariable.set() to set a default value for the window on loading. Everything works great. Code is below. from Tkinter import * import ttk parent = Tk() myvalue = StringVar() user_entry1 = ttk.Combobox(parent, values=['value 1', 'value2'], textvariable=myvalue) user_entry1.pack() myvalue.set('default value') mainloop() I now want to get a bit more complicated and use another Tk() instance, called root to to generate my

Python - Text widget from tkinter in tkk

自闭症网瘾萝莉.ら 提交于 2019-12-12 06:00:10
问题 I noticed that the Text widget from tkinter is not present in the ttk widgets. I'm using the ttk instead of tkinter because its interface suits better. And I need Text widget because it has multiple lines unlikely the Entry widget. Does anyone have a solution for my problem? 回答1: The solution is to use the tkinter text widget. tkinter and ttk are designed to work together. 来源: https://stackoverflow.com/questions/44658952/python-text-widget-from-tkinter-in-tkk