[Tutor] Fwd: Tkinter (was Filtering text files)

Don Arnold darnold02 at sprynet.com
Wed Apr 14 21:06:03 EDT 2004


>> From: Don Arnold <darnold02 at sprynet.com>
>> Date: April 14, 2004 8:01:33 PM CDT
>> To: "David Talaga" <dtalaga at novodynamics.com>
>> Cc: <tutor at python.org> <tutor at python.org>
>> Subject: Tkinter (was Filtering text files)
>>
>>
>> On Apr 14, 2004, at 7:34 PM, David Talaga wrote:
>>
>>> ok, so I am an idiot! There wan no ) after the .pack( ).  Never mind 
>>> about that. But now it is saying the this "AttributeError: 
>>> 'NoneType' object has no attribute 'select'"
>>> in the ugly red letters.  What now?!?!?!
>>> -----Original Message-----
>>> From: David Talaga [mailto:dtalaga at novodynamics.com]
>>> Sent: Wednesday, April 14, 2004 8:29 PM
>>> To: David Talaga; Kooser, Ara S; tutor at python.org
>>> Subject: RE: [Tutor] Filtering text files
>>>
>>> Oh yea, including this, the other problem I am having is when I run 
>>> it the statement after the if statements is aid to be illegal 
>>> syntax!?!?!?!
>>> The revised code is as follows:
>>> import os
>>> import Tkinter
>>> root=Tkinter.Tk()
>>> var=Tkinter.StringVar()
>>> entry=Tkinter.Entry(root, textvariable=var)
>>> entry.focus_set()
>>> entry.pack()
>>> var.set(root.title())
>>> def changeTitle(): root.title(var.get())
>>> def changeDriveC(): os.chdir('C:\\')
>>> def changeDriveD(): os.chdir('D:\\')
>>> def changeDriveE(): os.chdir('E:\\')
>>> def changeDriveF(): os.chdir('F:\\')
>>> def changeDriveG(): os.chdir('G:\\')
>>> Tkinter.Button(root, text="Change Title", command=changeTitle).pack()
>>> Tkinter.Button(root, text="Iconify", command=root.iconify).pack()
>>> Tkinter.Button(root, text="Close", command=root.destroy).pack()
>>> C=Tkinter.Radiobutton(text="Change dir to C:", value=0).pack()
>>> D=Tkinter.Radiobutton(text="Change dir to D:", value=0).pack()
>>> E=Tkinter.Radiobutton(text="Change dir to E:", value=0).pack()
>>> F=Tkinter.Radiobutton(text="Change dir to F:", value=0).pack()
>>> G=Tkinter.Radiobutton(text="Change dir to G:", value=0).pack()
>>>
>> From what I recall of Tkinter, the pack() method returns None, not 
>> the widget being packed.  Try:
>>
>> C = Tkinter.Radiobutton(text='Change dir to C:', value=0)
>> C.pack()
>> etc.
>>
>> and see how that works.
>>
>> HTH,
>> Don
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 5984 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20040414/4ce62129/attachment.bin


More information about the Tutor mailing list