Tkinter font question in Win2000

Martin Franklin martin.franklin at westgeo.com
Thu Oct 11 02:28:33 EDT 2001


Janos Blazi wrote:

> I should like to display a text (in a label) using the same font as
> anywhere else in my application but boldface.
> 
> It seemst to me that this is not trivial! Can anybody help me?
> 
> J.B.
> 
> 
> 
> 
> -----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
>  Check out our new Unlimited Server. No Download or Time Limits!
> -----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----
> 


Janos, 

Take a loot at the tkFont module:-


>>> import Tkinter
>>> root=Tkinter.Tk()
>>> import tkFont      
>>> font=tkFont.Font(family='Helvetica', size=12, weight='bold')
>>> l=Tkinter.Label(root, text='Hello World', font=font)
>>> l.pack()
>>> font1=tkFont.Font(family='Helvetica', size=12)
>>> l1=Tkinter.Label(root, text='Hello World', font=font1)
>>> l1.pack()

HTH
Martin.






More information about the Python-list mailing list