Fonts & Tinker
Angel
angel.gutierrez.rodriguez at gmail.com
Fri Jan 25 23:41:36 EST 2013
I am changing the default font for a Tkinter application:
class FuelControl(Tkinter.Frame):
def __init__(self,master):
self.version='0.02'
self.font=tkFont.Font(family="Helvetica",size=18)
print self.font.actual()
.
.
.
and everything looks ok:
{'family': 'Nimbus Sans L', 'weight': 'normal', 'slant': 'roman', 'overstrike': 0, 'underline': 0, 'size': 18}
and the size of the text are 18 on the screen. Then a button creates a new window through this callback:
def loc_add(self):
addw=Tix.Tk()
addw.title('Add location')
print self.font.actual()
Tkinter.Label(addw,text='Nickname:', font=self.font).grid(row=0,column=0)
Tkinter.Label(addw,text='Fullname:', font=self.font).grid(row=1,column=0)
Tkinter.Label(addw,text='Address:', font=self.font).grid(row=2,column=0)
Tkinter.Label(addw,text='Fuel name:',font=self.font).grid(row=3,column=0)
...
The self.font stays with the right value:
{'family': 'Nimbus Sans L', 'weight': 'normal', 'slant': 'roman', 'overstrike': 0, 'underline': 0, 'size': 18}
but the real displayed fonts in the window are smaller (default size of 12, maybe).
Am I missing something?
Thanks in advance,
A.
More information about the Python-list
mailing list