473,699 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Making a Label that looks the same as a button.

I have a Button object that gets replaced by a Label when clicked.

Button(buttonsf rame,text=' ',command=c,fon t=buttonsFont)
Note that the text is a single space. buttonsFont uses 'Courier New' as
a family.

When clicked, the Button is destroyed and replaced with a Label object:
Label(buttonsfr ame,text=x,font =buttonsFont,re lief=RAISED)

The intent is for the Label object to look identical to the button
object, except for the non-space character x. The Label object is a
little smaller than the Button object. When I set borderwidth, the
label object does increase in size, but that's not going to make it
look the same, since it makes the border thicker.

How do I get the Label object to look just like the Button object?

Jun 13 '06 #1
3 1846
On 13 Jun 2006 06:14:03 -0700, Dustan <Du**********@g mail.com> wrote:
I have a Button object that gets replaced by a Label when clicked.

Button(buttonsf rame,text=' ',command=c,fon t=buttonsFont)
Note that the text is a single space. buttonsFont uses 'Courier New' as
a family.

When clicked, the Button is destroyed and replaced with a Label object:
Label(buttonsfr ame,text=x,font =buttonsFont,re lief=RAISED)

The intent is for the Label object to look identical to the button
object, except for the non-space character x. The Label object is a
little smaller than the Button object. When I set borderwidth, the
label object does increase in size, but that's not going to make it
look the same, since it makes the border thicker.

How do I get the Label object to look just like the Button object?


There is least two other options that are different for Labels and Buttons:
b = Button(root)
b.cget('padx') '3m' b.cget('pady') '1m' l = Label(root)
l.cget('padx') '1' l.cget('pady')

'1'

The padx and pady are the distance between the text and the widget
borders. They are larger on a Button.

BTW, you can get all configuration options for any widget with:

for k in widget.configur e().keys():
print k, ':', widget.cget(k)

So you can easily compare common options between a standard Label and a
standard Button.

HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in
'U(17zX(%,5.zmz 5(17l8(%,5.Z*(9 3-965$l7+-'])"
Jun 13 '06 #2
It's imperative that you explain which toolkit you are using since
they all have differences.

On Jun 13, 2006, at 9:14 AM, Dustan wrote:
I have a Button object that gets replaced by a Label when clicked.

Button(buttonsf rame,text=' ',command=c,fon t=buttonsFont)
Note that the text is a single space. buttonsFont uses 'Courier
New' as
a family.

When clicked, the Button is destroyed and replaced with a Label
object:
Label(buttonsfr ame,text=x,font =buttonsFont,re lief=RAISED)

The intent is for the Label object to look identical to the button
object, except for the non-space character x. The Label object is a
little smaller than the Button object. When I set borderwidth, the
label object does increase in size, but that's not going to make it
look the same, since it makes the border thicker.

How do I get the Label object to look just like the Button object?

--
http://mail.python.org/mailman/listinfo/python-list


---
Andrew Gwozdziewycz
ap****@gmail.co m
http://23excuses.com | http://ihadagreatview.org | http://and.rovir.us
Jun 13 '06 #3
Andrew Gwozdziewycz wrote:
It's imperative that you explain which toolkit you are using since
they all have differences.


however, if you knew the answer, you would have recognized what toolkit
he was using.

</F>

Jun 13 '06 #4

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

Similar topics

8
2403
by: pmud | last post by:
Hi, I have 2 questions: 1. I have an editable data grid with 21 columns. I need to edit only 2 cloumns in this data grid. But when the grid is displayed in Edit mode, all the columns show long text boxes whichmakes the user to SCROLL a lot. I need only these 2 cloumns to be displayed in Edit mode. Is that possible & how? 2. Also, even when the data grid is not displayed in the edit mode, it
9
3181
by: tshad | last post by:
I have a datagrid that I want to add a new column to. This column will only be visible under certain conditions. So I want to set the column visible=false. Then when the right condition happens to change it to visible=true. You can't do that with a bound column (no ID), but you can create a templatecolumn with a label. To make these visible, I am going through each datagriditem and making them visible after I have bound the data to...
6
3145
by: jcrouse | last post by:
I am rotating some text is some label controls. In the one place I use it it works fine. In the other place I use it I can't figure out the syntax. I don't really understand the event. Where it works fine, it seems to fire when the form changes visibility. Here is the code. Private Sub lblP1JoyUp_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles lblP1JoyUp.Paint If lblP1JoyUp.Visible = True Then Dim...
3
2417
by: Neil Wallace | last post by:
Hi, This is an odd one. I've been struggling to get "double click" to work well for my controls. The same event handler works perfectly for buttons, but not for labels. Can anyone tell me why not? Below is an working VB.Net example to illustrate what I mean.
3
1748
by: Joe | last post by:
I'm connecting to an Oracle database and running a query which returns data. The query can be fairly long - 2-3 minutes. I have a label set up on the form which is invisible to begin with. I want to make it visible (with it's message) when the user clicks a button to run the query. The label informs the user that the system is getting the data. My code to do this is: Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e...
69
8060
by: kabradley | last post by:
Alrighty Guys and Gals, I have another question that I hope you all can help me with. I have a report that uses a cross-tab query as its record source. This cross-tab query is getting all of its information from another query. That query, qryRpt, is pulling information from several different tables. One of these table is tblDistributions, a table that holds monthly distributions for a particular investment, and the second is tblDeduction, a...
6
2855
by: andrew.ames | last post by:
Hi I have a pretty basic windows application created in Visual Studio 2005 and VB.NET. I set my Form's font to Arial 8.25pt, so when i added a label and a button they automatically have a font of Arial and 8.25pt. Great.
16
2402
by: Andrea Gavana | last post by:
Hi Diez & All, Do you mind explaining "why" you find it *buttugly*? I am asking just out of curiosity, obviously. I am so biased towards wxPython that I won't make any comment on this thread in particular, but I am curious to know why some people find it "ugly" or "bad" or whatever. It has its own bugs and missing features, of course, but it is one of the major GUI player in the arena, together with PyQt and PyGTK.
5
2029
by: Andy B | last post by:
I have 2 TextBoxes and an Add button on a page. When the user fills in the TextBoxes, the values are added to a dataset table. When the page gets done reloading, the TextBoxes are turned into readonly mode, the requiredFieldValidaters are set to disabled, the character counter for each textbox is made invisible and edit buttons show up next to the read only textboxes. I want to make the Add button invisible and then make a save changes...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.