TK question

James Stroud jstroud at mbi.ucla.edu
Thu Oct 20 22:50:53 EDT 2005


Forgot to answer the "better" part:


class optFrame(Frame):

   def __init__(self, *args, **kwargs):
     Frame.__init__(self, *args, **kwargs)
     self.pack()
     self.make_widgets()
   def make_widgets(self):
     """
     Put widgets here.
     """
     pass


def main():

   tk = Tk()
   optWin = optFrame(tk)
   tk.mainloop()


if __name__ == "__main__":

   main()


James

On Thursday 20 October 2005 19:16, MBW wrote:
> I have a class that is a windows in a GUI
>
> the following is the code:
>
> class optWin:
>
>     def __init__(self):
>         return None
>
>     def __call__(self):
>         self.root = tk()
>         self.root.title("My title")
>         self.root.mainloop()
>         return None
>
> 1)Why doesn't this work when I go to call optWin
> 2)What is a better way to do this
>
> Thanks in advance

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/



More information about the Python-list mailing list