ttk

TTK Notebook Share data between imported tabs

*爱你&永不变心* 提交于 2019-12-25 06:26:57
问题 I designed an application using the ttk notebook and I created three tab. Everyone of them has a starkly distinct and complex layout and very few functions and methods in common between them. As a result, the code file is getting quite hard to understand with so many line of code dedicated to the layout. There is a way to create every tab as a separate module/file/class and "import" them, so that they can be easier to maintain? EDIT: The problem I had was how to share attributes between the

Saving variables in 'n' Entry widgets Tkinter interface

混江龙づ霸主 提交于 2019-12-24 20:38:00
问题 Firstly apologises for the length of code but I wanted to show it all. I have an interface that looks like this: When I change the third Option Menu to "List" I will add in the option to have 'n' values (not shown). I then require 'n' columns where the user can input their values. I also have the problem where there may be 'n' amount of rows depending on a text file opened by the interface. I am therefore wondering if it possible (as I'm having difficulties not repeating the same values in

Python/ttk/tKinter - passing an argument with a button click func?

家住魔仙堡 提交于 2019-12-24 07:38:38
问题 I'm trying to pass an argument to a button click func and encountering an issues. In short, I am trying to get a button press to pop up out the askColor() method, and return that colour value as the background colour of the related textbox. Its function is so synaesthets can associate a colour with a letter/number and record the resulting colour list. specific lines: self.boxA = Text(self.mainframe, state='normal', width=3, height=1, wrap='word', background=self.AVal).grid(column=2, row=2,

Is there a way to set tabs of a Notebook below one another?

点点圈 提交于 2019-12-23 20:32:49
问题 So far when using the ttk.Notebook widget, but I am unable to set tabs below one another, they keep piling up eastward. Is there a way to set them to stack somehow? 回答1: No, there is not a way to do that with the ttk notebook widget. On a side note: multiple rows of tabs is widely regarded as being very user-UNfriendly from a usability perspective. If you need to create a UI that has that many tabs, you might want to consider a different approach if you're concerned about how easy your

ttk tkinter multiple frames/windows

核能气质少年 提交于 2019-12-23 09:55:49
问题 The following application I have created is used to demonstrate multiple windows in tkinter. The main problem is that none of the Entry controls, neither in the bmi-calculator or the converter, accept the values in the entry boxes - they get a ValueError when I do a calculation. from tkinter import * from tkinter import ttk from tkinter import messagebox class App1(ttk.Frame): def createWidgets(self): #text variables self.i_height = StringVar() self.i_weight = StringVar() self.o_bmi =

Is there an in depth ttk styling guide available? [closed]

为君一笑 提交于 2019-12-21 17:26:03
问题 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 3 years ago . So I've begun dabbling with Tkinter as of late, and I have it in my head to create what is essentially an application for storytelling. Ultimately, I'd like stylize most every widget used to conform with some overall aesthetic of my design. Originally, I though I'd have to create most all of my application

tkinter.ttk.Treeview root node icon/image does not appear

扶醉桌前 提交于 2019-12-20 05:46:16
问题 Problem: I am not able to get an icon image to appear next to the root node in tkinter.ttk.Treeview. Below is a test code I used. It executed w/o errors but image did not appear on the left of root node. I have tried using the full path name of the image file but that did not work. Also, I have tried using PIL.ImageTk.PhotoImage to open the image file but that did not work either. Instead an error as shown below appeared. Question: How do I get an icon image to appear on the left of the root

Backporting Python 3 tkinter & ttk code to Python 2.7

╄→尐↘猪︶ㄣ 提交于 2019-12-20 04:55:18
问题 I'm following a Sentdex tutorial, found here, specifically this part about creating a GUI in Python. However the tutorial is in python 3 and I'm using 2.7. Importing Tkinter is fine, however when I come to importing ttk and then inheriting it into the class, a problem arises. In python 2.7 ttk is a separate module, which means is not in the Tkinter module. import Tkinter as tk import ttk LARGE_FONT= ("Verdana", 12) class SeaOfBTCApp(tk.Tk): def __init__(self, *args, **kwargs): tk.Tk.__init__

How do you overlap widgets/frames in python tkinter?

a 夏天 提交于 2019-12-19 19:53:31
问题 I was wondering if this is even possible. My goal is to have a small white box in the bottom right hand corner, on top of a larger text field. The white box will be used as an "info box" while the person scrolls through the text inside of the text field. When I say "text field" I mean Text from tkinter. 回答1: The way to place one widget on top of other widgets is to use the place geometry manager. You can specify an x/y coordinate relative to some other widget, as well as to specify either

How to do a screenshot of a tkinter application?

不问归期 提交于 2019-12-19 04:24:42
问题 I need to do a screenshot of the content of the tkinter application below. I am on Windows 7 (or 8). from Tkinter import * def test(x): #print "I'm in event:", x if x == 1: # if event on entry e1 print 'e1 event' # do some thing elif x == 2: # also if event on entry e2 print 'e2 event' # do some thing else else: print 'no event' def test1(x): test(1) def test2(x): test(2) root=Tk() root.minsize(500,500) e1=Entry(root) e1.pack() e2=Entry(root) e2.pack() e1.bind( "<FocusOut>", test1) e2.bind( "