Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 8th, 2003, 11:45 AM
Gerardoj's Avatar
Gerardoj Gerardoj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Somewhere over the Rainbow
Posts: 128 Gerardoj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 54 m 28 sec
Reputation Power: 10
Error Exception in Tkinter callback

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)

Reply With Quote
  #2  
Old November 8th, 2003, 01:00 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Sounds too me like there isn't an option called 'font'? I'm not big GUI guy (i should add that to my profile , not that i'd pick Tkinter even if i was) so i can't really confirm or deny that..

Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #3  
Old November 8th, 2003, 09:52 PM
Gerardoj's Avatar
Gerardoj Gerardoj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Somewhere over the Rainbow
Posts: 128 Gerardoj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 54 m 28 sec
Reputation Power: 10
Sorry, I fixed, the problem was self.window.config(font=font)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Error Exception in Tkinter callback

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap