943,974 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 562
  • Python RSS
Aug 31st, 2009
0

Radiobutton with Tkinter

Expand Post »
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:

Python Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 24
Solved Threads: 1
Light Poster
Lingson is offline Offline
27 posts
since Aug 2009
Aug 31st, 2009
0

Re: Radiobutton with Tkinter

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?
Reputation Points: 24
Solved Threads: 1
Light Poster
Lingson is offline Offline
27 posts
since Aug 2009
Aug 31st, 2009
1

Re: Radiobutton with Tkinter

Courier is the most common font to space all character equal.
Reputation Points: 961
Solved Threads: 211
Nearly a Posting Maven
sneekula is offline Offline
2,413 posts
since Oct 2006
Aug 31st, 2009
0

Re: Radiobutton with Tkinter

Grid does not have anchor, but it has sticky:
Python Syntax (Toggle Plain Text)
  1. rb[i].grid(row=i, column=0, sticky='w')
Reputation Points: 961
Solved Threads: 211
Nearly a Posting Maven
sneekula is offline Offline
2,413 posts
since Oct 2006
Aug 31st, 2009
0

Re: Radiobutton with Tkinter

whoa!! thanks a lot..

You saved my day! (Those are not so beautiful fonts, and now I dont need to use them)
Reputation Points: 24
Solved Threads: 1
Light Poster
Lingson is offline Offline
27 posts
since Aug 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: If / Else Statement Help
Next Thread in Python Forum Timeline: Easy Question (For You)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC