ttk

can't set background color ttk python os x using styles

不羁岁月 提交于 2020-01-03 01:54:19
问题 With this code fragment, I would expect the label to have a background color red. def createWidgets(self): style = ttk.Style() style.configure("Red.TLabel", foreground="green", background="red") self.label1 = ttk.Label(textvariable=self.numberArray[0][0],style="Red.TLabel") self.label1.pack() I get the green foreground color but I can't change the background color. This is on OS X. I'm using ActiveState's tcl and python. The same problem occurs with Python 3.2 and 2.7 回答1: You'll sometimes

can't set background color ttk python os x using styles

。_饼干妹妹 提交于 2020-01-03 01:54:06
问题 With this code fragment, I would expect the label to have a background color red. def createWidgets(self): style = ttk.Style() style.configure("Red.TLabel", foreground="green", background="red") self.label1 = ttk.Label(textvariable=self.numberArray[0][0],style="Red.TLabel") self.label1.pack() I get the green foreground color but I can't change the background color. This is on OS X. I'm using ActiveState's tcl and python. The same problem occurs with Python 3.2 and 2.7 回答1: You'll sometimes

changing colour of ttk.Progressbar elements in the xpnative theme - python

早过忘川 提交于 2019-12-31 03:24:28
问题 I'm using python 2.7 and TK to make a gui which accesses text files and uses data in them to do many things, but the one relevant here is sending a gchat message. Currently, I have everything working, the point I need some help with is when I call my module to send the message, the message is sent perfectly, although I wanted the user to have an indication of the process happening, so I created a ttk.progressbar. but there is a few things I'd like to improve on this: 1) I would like to change

ttk Entry background colour

橙三吉。 提交于 2019-12-30 04:34:07
问题 How exactly do I change the background colour of an Entry widget from ttk? What I have so far is: self.estyle = ttk.Style() self.estyle.configure("EntryStyle.TEntry", background='black') self.estyle.map("EntryStyle.TEntry", foreground=[('disabled', 'yellow'), ('active', 'blue')], background=[('disabled', 'magenta'), ('active', 'green')], highlightcolor=[('focus', 'green'), ('!focus', 'red')]) self.urlentry_v = StringVar() self.urlentry = ttk.Entry(self.input_frame, style="EntryStyle.TEntry",

Python: Tkinter/ttk themed Message Box

ⅰ亾dé卋堺 提交于 2019-12-30 04:17:26
问题 I started making a GUI with Tkinter and I added the module tkMessageBox as well. But recently I discovered that importing the module ttk gives more 'up-to-date' results: buttons and texts boxes appear with the actual style of the current OS. This is: Windows 10 buttons are plain and blue-lighted, and not those shaded gray blocky buttons from previous versions. But unfortunately, I can't find a way to use this ttk themed widgets on the common Dialog Boxes (the ones which I imported from

Python tkinter with ttk calendar

不想你离开。 提交于 2019-12-29 07:52:06
问题 I am using this code to create a simple calendar on my Tkinter. When i put a calendar on my main root window, the calendar appear just fine. So, i decided to put another button that will create a Tkinter toplevel window and put 1 more calendar on the toplevel window.But this time it failed to display the calendar and instead it gave me this error, " TclError: can't pack .18913120 inside .18912200.18912400" . Could anyone explain why am i getting this error message. this is my sample code:

Python tkinter with ttk calendar

霸气de小男生 提交于 2019-12-29 07:52:06
问题 I am using this code to create a simple calendar on my Tkinter. When i put a calendar on my main root window, the calendar appear just fine. So, i decided to put another button that will create a Tkinter toplevel window and put 1 more calendar on the toplevel window.But this time it failed to display the calendar and instead it gave me this error, " TclError: can't pack .18913120 inside .18912200.18912400" . Could anyone explain why am i getting this error message. this is my sample code:

Python tkinter with ttk calendar

痴心易碎 提交于 2019-12-29 07:52:04
问题 I am using this code to create a simple calendar on my Tkinter. When i put a calendar on my main root window, the calendar appear just fine. So, i decided to put another button that will create a Tkinter toplevel window and put 1 more calendar on the toplevel window.But this time it failed to display the calendar and instead it gave me this error, " TclError: can't pack .18913120 inside .18912200.18912400" . Could anyone explain why am i getting this error message. this is my sample code:

How to set the min and max height or width of a Frame?

无人久伴 提交于 2019-12-29 04:14:53
问题 The size of Tkinter windows can be controlled via the following methods: .minsize() .maxsize() .resizable() Are there equivalent ways to control the size of Tkinter or ttk Frames? @Bryan: I changed your frame1.pack code to the following: frame1.pack(fill='both', expand=True) frame1.bind( '<Configure>', maxsize ) And I added this event handler: # attempt to prevent frame from growing past a certain size def maxsize( event=None ): print frame1.winfo_width() if frame1.winfo_width() > 200: print

I want to populate a ttk.combobox with results from database query

谁都会走 提交于 2019-12-25 08:49:25
问题 i am having a little problem i would need help with.This concerns python ttk.combobox widget I am new to python just started coding a week ago. I have a database which is populated by user input.This database is to store a user's stock input(e.g. items, cost, supplier ,etc).This part i have been able to do. From the database, am using a 'for' loop to get each seperate item from my database query into a ttk.combobox so a user can make selections. However my problem is,i get an error everytime.