small tkinter problem

oberon nextronix at yahoo.de
Wed Jul 31 08:51:26 EDT 2002


I am quite new to python and especially Tkinter ,i am really stuck on
a problem i cannot figure out with this simple seeming interface .

I really would apreciate some help ,most likely it is some really
stupid mistake ...lol

here the full error :

Traceback (most recent call last):
  File
"E:\Python22\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 301, in RunScript
    exec codeObject in __main__.__dict__
  File "D:\projects\oberon\mdbapp.py", line 27, in ?
    root.mainloop()
  File "D:\projects\oberon\mdbapp.py", line 21, in __init__
    self.results = Listbox(frame,
yscrollcommand=self.rescroll.set).grid(row=4,column=0,sticky=W+E,columnspan=2)
AttributeError: 'NoneType' object has no attribute 'set'


-------------------------------------------------------------


#!/usr/bin/env python

from Tkinter import *

class App:
  def __init__(self, master):
    frame = Frame(master)
    frame.pack()

    self.about =
Label(frame,text="something...").grid(row=0,sticky=W+E,columnspan=2)
    self.title =
Entry(frame).grid(row=1,sticky=W+E,columnspan=2,pady=5)

    self.query_b =
Button(frame,text="whatever").grid(row=2,column=0,sticky=W+E,pady=5)
    self.clear_b = Button(frame,text="Clear
results").grid(row=2,column=1,sticky=W+E)

    self.reslabel = Label(frame,text="Query
Results",fg="#009000").grid(row=3,column=0,sticky=W+E,columnspan=2)
    self.rescroll = Scrollbar(frame).grid(row=4,column=2)
  
    self.results =
Listbox(frame,yscrollcommand=self.rescroll.set).grid(row=4,column=0,sticky=W+E,columnspan=2)
    
    self.rescroll.config(command=self.results.yview)
     
root = Tk()
app = App(root)
root.mainloop()



More information about the Python-list mailing list