Radiobutton with Tkinter

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Aug 2009
Posts: 27
Reputation: Lingson is an unknown quantity at this point 
Solved Threads: 1
Lingson Lingson is offline Offline
Light Poster

Radiobutton with Tkinter

 
0
  #1
Aug 31st, 2009
hi,

how do I left justify all the radiobutton displayed?

For example, I have 5 radio button with different text, each on different row using:

  1. rb[i].grid(row=i, column=0)

Instead of displaying it left justified, its all centered.

I tried using anchor='w', but result the same.

I tried also to count the text length of each radiobutton and filling the text with spaces on the right so it all has the same length, which 'almost' work, but it seems that each character have different width.

If the radiobutton can't be left justified, what font can I use that have the same width for all character?

Thanks
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 27
Reputation: Lingson is an unknown quantity at this point 
Solved Threads: 1
Lingson Lingson is offline Offline
Light Poster

Re: Radiobutton with Tkinter

 
0
  #2
Aug 31st, 2009
Additional Note:

Searching with google, I found out that fonts with same width are called Monospaced Fonts.

Example of monospaced fonts:
Courier, Monaco, Fixedsys

Found a nice site about monospaced fonts for programmers:
http://www.kuro5hin.org/story/2004/12/6/11739/5249


So, the radiobutton problem can be 'tickled' by using monospaced fonts. But still, I would know if there is a way to do it with Tkinter by setting its attribute, instead of going around it with filling spaces to the text?
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,284
Reputation: sneekula has a spectacular aura about sneekula has a spectacular aura about 
Solved Threads: 176
sneekula's Avatar
sneekula sneekula is offline Offline
Nearly a Posting Maven

Re: Radiobutton with Tkinter

 
1
  #3
Aug 31st, 2009
Courier is the most common font to space all character equal.
No one died when Clinton lied.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,284
Reputation: sneekula has a spectacular aura about sneekula has a spectacular aura about 
Solved Threads: 176
sneekula's Avatar
sneekula sneekula is offline Offline
Nearly a Posting Maven

Re: Radiobutton with Tkinter

 
0
  #4
Aug 31st, 2009
Grid does not have anchor, but it has sticky:
  1. rb[i].grid(row=i, column=0, sticky='w')
No one died when Clinton lied.
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 27
Reputation: Lingson is an unknown quantity at this point 
Solved Threads: 1
Lingson Lingson is offline Offline
Light Poster

Re: Radiobutton with Tkinter

 
0
  #5
Aug 31st, 2009
whoa!! thanks a lot..

You saved my day! (Those are not so beautiful fonts, and now I dont need to use them)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC