473,396 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

disabledforeground or similar for Entry (in Tkinter)

Back in this post, I attempted to make a label look like a button:
http://groups.google.com/group/comp....q8zr21ODZBhouQ

Alright, I've learned my lesson - don't use a new widget; modify the
old one.

Except the Entry widget doesn't have a disabledforeground option.
Neither does the Text widget, but IDLE seems to accomplish making a
disabled Text look the same as an enabled Text in the IDLE Help
section.

No, foreground (fg) and background (bg) don't make a difference; it
still changes the color of the Entry widget upon disabling.

There must be something I'm missing here...

Nov 4 '06 #1
4 1872

Dustan wrote:
Back in this post, I attempted to make a label look like a button:
http://groups.google.com/group/comp....q8zr21ODZBhouQ

Alright, I've learned my lesson - don't use a new widget; modify the
old one.

Except the Entry widget doesn't have a disabledforeground option.
Neither does the Text widget, but IDLE seems to accomplish making a
disabled Text look the same as an enabled Text in the IDLE Help
section.

No, foreground (fg) and background (bg) don't make a difference; it
still changes the color of the Entry widget upon disabling.
There must be something I'm missing here...
Yes there is! I assumed that
http://www.pythonware.com/library/tk...47-options.htm
was telling the truth, in that it's not listed there.

Nov 4 '06 #2
On Saturday 04 November 2006 11:03, Dustan wrote:
Back in this post, I attempted to make a label
look like a button:
http://groups.google.com/group/comp.lang.python
/browse_thread/thread/a83195d3970a6851/2053cbaec
1bc1f19?auth=DQAAAHkAAAAMDAWnhNnzpuKlwOKZUwAGUT t
T2Ay-EAB7rCY6SnwfnDzZ98M37bZDW2Is0LrBVrr8XEgPfcu
OkiUE-CrSsKbBSX-67voDUXfbATBd0eYNMClezby4EXT2fuL
m6f0llJ_xMO8BfkjVho_7CZvlf_9tNGnJixTbq8zr21ODZB h
ouQ

Alright, I've learned my lesson - don't use a
new widget; modify the old one.

Except the Entry widget doesn't have a
disabledforeground option. Neither does the
Text widget, but IDLE seems to accomplish
making a disabled Text look the same as an
enabled Text in the IDLE Help section.

No, foreground (fg) and background (bg) don't
make a difference; it still changes the color
of the Entry widget upon disabling.

There must be something I'm missing here...
Have you tried the state option ?

state = 'disabled'

It works for Text, Entry, and Button.

Once disabled you won't be able to make changes
until state= 'normal'

jim-on-linux

http://www.inqvista.com
Nov 4 '06 #3
On Saturday 04 November 2006 11:03, Dustan wrote:
Back in this post, I attempted to make a label
look like a button:
http://groups.google.com/group/comp.lang.python
/browse_thread/thread/a83195d3970a6851/2053cbaec
1bc1f19?auth=DQAAAHkAAAAMDAWnhNnzpuKlwOKZUwAGUT t
T2Ay-EAB7rCY6SnwfnDzZ98M37bZDW2Is0LrBVrr8XEgPfcu
OkiUE-CrSsKbBSX-67voDUXfbATBd0eYNMClezby4EXT2fuL
m6f0llJ_xMO8BfkjVho_7CZvlf_9tNGnJixTbq8zr21ODZB h
ouQ

Alright, I've learned my lesson - don't use a
new widget; modify the old one.

Except the Entry widget doesn't have a
disabledforeground option. Neither does the
Text widget, but IDLE seems to accomplish
making a disabled Text look the same as an
enabled Text in the IDLE Help section.

No, foreground (fg) and background (bg) don't
make a difference; it still changes the color
of the Entry widget upon disabling.

There must be something I'm missing here...
My previous post was hasty and we all know,
"Haste makes waste."

Try this;

If you use wiget-01.pack_forget() or
wiget-01.grid_forget(), you can now build
wiget-02 using wiget-02.pack or grid() for the
same location.

You can reinstall uninstalled wigets by using
pack() or grid() again for those hidden wigets.
However only after uninstalling for the wigets in
those locations.

root = Tk()

test1 = Button(root, text='Test No.1 button', bg =
'yellow', width = 15, height = 10)
test1.grid(row=0, column=0)
test1.grid_forget()
test2 = Button(root, text='Test #2 button', bg =
'green', width = 15, height = 10)
test2.grid(row=0, column=0)

mainloop()
jim-on-linux

http://www.inqvista.com



Nov 5 '06 #4
Since others want to see more,
Try this, you can make the changes you want to the
look of your final output with grid or
pack_forget() .

root = Tk()
class Ktest:
def __init__(self):
self.Ftest1()

def Ftest1(self):
try:
self.test2.grid_forget()
except AttributeError :
pass
self.test1 = Button(root, text='Push #1
button', bg = 'yellow',
width = 25,
command = self.Ftest2,
height = 25)
self.test1.grid(row=0, column=0)
def Ftest2(self):
self.test1.grid_forget()

self.test2 = Button(root, text='Push #2
button', bg = 'green',
width = 25,
command = self.Ftest1,
height = 8)
self.test2.grid(row=0, column=0)
if __name__== '__main__' :
Ktest()
mainloop()
jim-on-linux

http://www.inqvista.com
On Saturday 04 November 2006 11:03, Dustan
wrote:
Back in this post, I attempted to make a
label look like a button:
http://groups.google.com/group/comp.lang.pyth
on
/browse_thread/thread/a83195d3970a6851/2053cb
aec
1bc1f19?auth=DQAAAHkAAAAMDAWnhNnzpuKlwOKZUwAG
UTt
T2Ay-EAB7rCY6SnwfnDzZ98M37bZDW2Is0LrBVrr8XEgP
fcu
OkiUE-CrSsKbBSX-67voDUXfbATBd0eYNMClezby4EXT2
fuL
m6f0llJ_xMO8BfkjVho_7CZvlf_9tNGnJixTbq8zr21OD
ZBh ouQ

Alright, I've learned my lesson - don't use a
new widget; modify the old one.

Except the Entry widget doesn't have a
disabledforeground option. Neither does the
Text widget, but IDLE seems to accomplish
making a disabled Text look the same as an
enabled Text in the IDLE Help section.

No, foreground (fg) and background (bg) don't
make a difference; it still changes the color
of the Entry widget upon disabling.

There must be something I'm missing here...

My previous post was hasty and we all know,
"Haste makes waste."

Try this;

If you use wiget-01.pack_forget() or
wiget-01.grid_forget(), you can now build
wiget-02 using wiget-02.pack or grid() for the
same location.

You can reinstall uninstalled wigets by using
pack() or grid() again for those hidden wigets.
However only after uninstalling for the wigets
in those locations.

root = Tk()

test1 = Button(root, text='Test No.1 button',
bg = 'yellow', width = 15, height = 10)
test1.grid(row=0, column=0)
test1.grid_forget()
test2 = Button(root, text='Test #2 button', bg
= 'green', width = 15, height = 10)
test2.grid(row=0, column=0)

mainloop()
jim-on-linux

http://www.inqvista.com
Nov 5 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Thomas Nücker | last post by:
Hi! I am creating a dialog-box within my application, using tkinter. The problem is the following: After the dialogbox is started, the main application window comes again to top and the...
2
by: Nicolas Favre-Félix | last post by:
Hello, I have a little problem using Tkinter: I'd like to make a interface with 3 labels on the left, facing with 3 Entry on the right, a button below Entrys, and a Listbox under all. I could...
5
by: Dean Allen Provins | last post by:
I need to determine the size of a canvas while the process is running. Does anyone know of a technique that will let me do that? Thanks, Dean
2
by: Fuzzyman | last post by:
Hello all, I have some Tkinter buttons that display images. I would like to change these to 'active' images when the mouse is over the button. I see that the button widget can take an...
44
by: bg_ie | last post by:
Hi, I'm in the process of writing some code and noticed a strange problem while doing so. I'm working with PythonWin 210 built for Python 2.5. I noticed the problem for the last py file...
1
by: C Martin | last post by:
What am I doing wrong in this code? The callback doesn't work from the Entry widget. ##start code import Tkinter tk = Tkinter.Tk() var = Tkinter.StringVar() print var._name def cb(name,...
1
by: Helmut Jarausch | last post by:
Hi, I don't want to reinvent the wheel but I cannot find it so far. Many editors have a so-called incremental search feature. As you type characters, elements of a set of strings which fit so...
1
by: Dude | last post by:
Hi All, I am fairly new to Python programming. I am working on a small Tkinter project and I think I am missing something, maybe you can help. The two lines below is all I have related to the...
13
by: v13tn1g | last post by:
so basically my GUI window has 4 text entries where the user inputs stuff. i have created a clear button with in my window, the thing that i was wondering is how do i create a function to associate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.