Menu
  • HOME
  • TAGS

Cannot make default value display for for ttk entry widget using the textvariable parameter

python,tkinter,ttk

If I understand your code, you are doing everything correctly syntactically. If the value is appearing blank on the screen, the only explanation is that commentEntryVar is a local variable that is being garbage-collected after the widget is created but before the window appears. If it is a local variable,...

Jump out in Tkinter loop

python,user-interface,loops,tkinter,ttk

To make your window execute only once and have plus button closing the window do as follow: from Tkinter import * import ttk def plus(*args): value = float(a.get()) value1 = float(b.get()) result.set(value + value1) print "the result is " + str(result.get()) root.destroy() ####### look here !!!####### root = Tk() root.title("Plus...

How to have tabs of a ttk Notebook in different rows?

python,tabs,tkinter,ttk

It is not possible with ttk to do this and it is a horrible design anyway. Instead, create an "options dialog" where you put either a list or a treeview in a panel on the side and use that to select among your many subpages. You can then use a...

Can a ttk style option be deleted?

python,tkinter,tk,ttk

This was never implemented. In Tcl/Tk this kind of test can be created using slave interpreters and the entire test environment discarded. In Python I think the nearest equivalent is to create a thread, load Tk in that thread and destroy it following the test. That should isolate the various...

Change color of “tab header” in ttk.Notebook

python,tkinter,ttk

You can try creating a custom theme. import tkinter as tk from tkinter import ttk root = tk.Tk() mygreen = "#d2ffd2" myred = "#dd0202" style = ttk.Style() style.theme_create( "yummy", parent="alt", settings={ "TNotebook": {"configure": {"tabmargins": [2, 5, 2, 0] } }, "TNotebook.Tab": { "configure": {"padding": [5, 1], "background": mygreen }, "map":...

How to change the tab of ttk.Notebook

python,tkinter,ttk

see the following link: Python Docs if you see the select method that should do what you're after, so something like this: notebook.select(tab_id) where the tab id can take a number of forms (see section 24.2.5.3) but the most useful ones are an integer (i think this is the index...

Show extracting a .zip file progress Python Tkinter ProgressBar

python,tkinter,zip,progress-bar,ttk

After finding the answers not very helpful unfortunately :(. But I have managed to find a example that was very helpful and did exactly what I wanted! It got the percentage of the extraction :). Here is a link to where I found it: Monitor ZIP File Extraction Python Here...

Ttk scrollbar's thumb won't resize

tkinter,scrollbar,tk,ttk

Scrollbars and widgets need a two-way connection. The scrollbar must be able to tell the scrollable widget to scroll, and the widget must be able to tell the scrollbar where and how to draw the thumb. You are not telling the tree widget to update the scrollbar with the information...

Manually triggering the ttk notebook tab change event

python,events,tabs,tkinter,ttk

You can generate virtual events (eg: events that begin and end with << and >>) with event_generate: self.the_notebook.event_generate("<<NotebookTabChanged>>") ...

How to get the Combo Box Value

python,combobox,tkinter,ttk

I simplified your code and made a working example but you should consider learning Python a bit more before dealing with complex GUI. from tkinter import messagebox, Tk, Menu, ttk news = ['Mid Day News', 'Evening News'] features = ['Calling Farmers', 'Round About Ja', 'You and the Law', 'Get the...

How to align text to the right in ttk Treeview widget?

python,tkinter,ttk

The ttk.Treeview widget has an anchor option you can set for each column. To set the anchor of a column to the right side use: ttk.Treeview.column(column_id, anchor=Tkinter.E) ...

How to bring up symbols in Python ttk.buttons

button,python-3.x,tkinter,ttk

Python 3 and tkinter work perfectly fine with unicode symboles. So you can just use these sympols directly. For example: from tkinter import * from tkinter import ttk root = Tk() backspace = ttk.Button(root, text="←") backspace.grid(row=0, column=0, padx=2, pady=0, sticky="nw") plusminus = ttk.Button(root, text="→") plusminus.grid(row=0, column=1, padx=2, pady=2, sticky="nw") sqroot...

Some ttk styles not accessible from within python script

python,tkinter,ttk

Some of the ttk themes are supported on only one platform. xpnative, winnative, and vista, for example, only work on windows. The "aqua" theme only works on OSX. The others, I think, run on any platform. If you're running via cygwin, the version of python you're running was probably configured...

TypeError: __init__() takes exactly 2 arguments (3 given)

python,python-2.7,tkinter,ttk

@fhdrsdg has pointed out the answer where all the class added should have same definition like this : class Page1(Tkinter.Frame): def __init__(self, parent, controller): Tkinter.Frame.__init__(self, parent) class Page2(Tkinter.Frame): def __init__(self, parent, controller): Tkinter.Frame.__init__(self, parent) and so on... You can see that all the page class have the same ascending order...

forget widgets inside a PanedWindow in Tkinter

tkinter,ttk

PanedWindow have a forgetmethod accepting a widget as parameter. In your example, you migh use pwin.forget(bottom)....

wxpython — a frame or panel similar to labelframe in ttk?

user-interface,wxpython,ttk

You mean something like that? wxPython StaticBox? Will act together with STaticBoxSizer as container for other controls.

How can I ensure my ttk.Entry's invalid state isn't cleared when it loses focus?

python,validation,tkinter,ttk

Why it happens In the Tk source file generic/ttk/ttkEntry.c, EntryRevalidate() is always run on focus events. This calls EntryValidateChange(), which, when it notices that validation on focus events is "turned off", returns a result indicating that the current value is valid to EntryRevalidate(), which accordingly clears the invalid flag. So,...

Why does tkinter.ttk Combobox clear displayed value on initial selection only?

python,python-3.x,combobox,tkinter,ttk

At one point in your code self.combovar points to an instance of a StringVar, but later you redefine self.combovar to be a string. The solution is to not redefine self.combovar inside newselection

get default background of ttk.Frame

python,canvas,tkinter,tk,ttk

You can use s.lookup() to get settings of a style. If you want the background setting of your ttk Frame use: s = ttk.Style() bg = s.lookup('TFrame', 'background') Which you can apply to your Canvas: canvas = Canvas(tab, borderwidth=0, background=bg) ...

Configuring independent widgets (Tkinter ttk, Python)

python,user-interface,tkinter,widget,ttk

You need to do two things: Create a new tkinter.ttk.Style for the button that has its foreground option set to red. Assign the button's style option to this style. Below is a fixed version of your script: from tkinter import * from tkinter import ttk def calculate(*args): try: valuex=int(x.get()) valuey=int(y.get())...

Setting the relief of a button in ttk

python,python-2.7,ttk

The Tk themeing system redefines widgets in terms of separate visual elements that are composed together using a layout and style configuration options to yield a visual representation of the widget that depends on the chosen theme and the widget state. This allows Tk to request that the Windows Visual...

How to change the color of ttk button

python,button,tkinter,ttk

Unfortunately, there isn't an easy way to change the foreground of a button from the ttk library. It is always the standard Windows gray like in your picture. But you can easily get what you want with a normal tkinter.Button if you set the right options. Below is an example...

Simple GUI, only consider values when available

python,user-interface,tkinter,ttk

c.get() doesn't always return something like "0.02", it will return "" if there is no user input, in this case it will throw an exceptiong showing error to transfer "" to float. so I modified your code, added something to check the user input. from Tkinter import * import ttk...

Link 2 comboboxes to a single function and return its value

python,combobox,tkinter,ttk

The event object that is automatically passed when a bound function is called contains the attribute widget, which is the widget that triggered the event. So you can bind both comboboxes' <<ComboboxSelected>> to trigger self.information (without parentheses) and define that as def information(self, event): combo_var = event.widget.get() print combo_var ...

Removing Ttk Notebook Tab Dashed Line

python,tkinter,ttk

You can remove this focus mark by altering the sub elements of tab widget. Ttk widgets are decomposed in subelements. The layout of these elements is described through layout method (or in a layout parameter of theme_create). Here is a command to remove layout marks (you can apply it directly...

Python 3.4.3 Tkinter TTK file not opening

python,tkinter,python-3.4,ttk

I can't reproduce your error, but I have an idea what's causing it. My guess is that your OS runs .pyw files using py2. You can double check this in your registry (assuming Windows). Check the following key Computer\HKEY_CLASSES_ROOT\Python.NoConFile\shell\open\command And change its default value to "C:\Python34\pythonw.exe" "%1" %* Or wherever...

Padding specified in style ignored by Ttk Frame

python,tkinter,tk,ttk

The layout for the TFrame does not include a padding element so there is no style element to make use of the configured padding value in your style. You can see this by inspecting the layout: >>> from tkinter import * >>> from tkinter.ttk import * >>> style = Style()...

How do I make a color selection scale in Tkinter?

python,tkinter,color-picker,ttk

Your problem is that you are using a one-dimensional scale for a three-dimensional color space. For what you're looking for, I would suggest using the HSL or HSV color space instead, with the scale in question manipulating the Hue parameter. When you do need RGB values, you can obtain them...

Disabling tkinter ttk scale widget

python,user-interface,tkinter,ttk

For ttk widgets you use the state method. The state method for buttons and entry widgets are just a convenience function to mimic the standard button and entry widgets. You can rewrite your function like this: def disable_widgets(parent): for child in parent.winfo_children(): child.state(["disabled"]) ttk states are mentioned in the ttk...