Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-08-2003, 09:41 PM
|
#1
|
Member
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465
Rep:
|
Python and Tkinter Error
Hi, I have an error in my code:
bash-2.05b$ python NOTEPAD.py
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 1300, in __call__
return apply(self.func, args)
File "NOTEPAD.py", line 110, in set_font
self.window.config(font=font)
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 1093, in configure
self.tk.call((self._w, 'configure')
TclError: unknown option "-font"
WHAT COULD BE THE PROBLEM? THANKS
Code:
def change_font(self):
def set_font():
if self.size_check.get() == 1:
if self.font_check.get() == 1:
font = ('times', 10, 'normal')
elif self.font_check.get() == 2:
font = ('system', 10, 'normal')
elif self.font_check.get() == 3:
font = ('courier', 10, 'normal')
else:
font = ('helvetica', 10, 'normal')
elif self.size_check.get() == 2:
if self.font_check.get() == 1:
font = ('times', 12, 'normal')
elif self.font_check.get() == 2:
font = ('system', 12, 'normal')
elif self.font_check.get() == 3:
font = ('courier', 12, 'normal')
else:
font = ('helvetica', 12, 'normal')
elif self.size_check.get() == 3:
if self.font_check.get() == 1:
font = ('times', 14, 'normal')
elif self.font_check.get() == 2:
font = ('system', 14, 'normal')
elif self.font_check.get() == 3:
font = ('courier', 14, 'normal')
else:
font = ('helvetica', 14, 'normal')
else:
if self.font_check.get() == 1:
font = ('times', 18, 'normal')
elif self.font_check.get() == 2:
font = ('system', 18, 'normal')
elif self.font_check.get() == 3:
font = ('courier', 18, 'normal')
else:
font = ('helvetica', 18, 'normal')
self.window.config(font=font)
top.destroy()
top = Toplevel(width=100, height=100)
top.title("Cambio de Fuente")
top.resizable(height=0, width=0)
top.focus_set()
self.size_check = IntVar()
self.size_check.set(2)
self.font_check = IntVar()
self.font_check.set(1)
self.style_check = IntVar()
self.style_check.set(1)
size_1 = Radiobutton(top, text="10", variable=self.size_check, value=1)
size_2 = Radiobutton(top, text="12", variable=self.size_check, value=2)
size_3 = Radiobutton(top, text="14", variable=self.size_check, value=3)
size_4 = Radiobutton(top, text="18", variable=self.size_check, value=4)
font_1 = Radiobutton(top, text="Times", variable=self.font_check, value=1)
font_2 = Radiobutton(top, text="System", variable=self.font_check, value=2)
font_3 = Radiobutton(top, text="Courier", variable=self.font_check, value=3)
font_4 = Radiobutton(top, text="Helvetica", variable=self.font_check, value=4)
size_1.grid(row=0, column=0)
size_2.grid(row=0, column=1)
size_3.grid(row=0, column=2)
size_4.grid(row=0, column=3)
font_1.grid(row=1, column=0)
font_2.grid(row=1, column=1)
font_3.grid(row=1, column=2)
font_4.grid(row=1, column=3)
cancel = Button(top, width=6, text="cancel", command=top.destroy, relief=RIDGE)
cancel.grid(row=2, column=1)
ok = Button(top, width=6, text="ok", command=set_font, relief=RIDGE)
ok.grid(row=2, column=2)
|
|
|
11-08-2003, 09:52 PM
|
#2
|
Member
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465
Original Poster
Rep:
|
Sorry, I fixed, the problem was self.window.config(font=font)
|
|
|
All times are GMT -5. The time now is 11:23 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|