List Info

Thread: Executing Tkinter UI from another class




Executing Tkinter UI from another class
country flaguser name
United States
2007-06-01 11:48:16
Hello,

I'm still learning how to call class methods from other
classes. I'm trying
to figure out what is the best approach to executing a
Tkinter UI from
another class. It tells me that it expects two aurguments
but received only
1. I expect it may have something to do with "app =
App(root)" from
class1.py. 
I also tried defining another procedure that would execute
both but I'm
still confused. 
Thanks for the help!

Frank


For example: 

Class1.py
-----------------------------------------------
import Tkinter


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

    def makeFrames(self):
         code
    def makeRest(self):
         code
    def gerChars(self):
         code

    def createUI(self):
        #creates the UI
        self.makeFrames()
        self.makeRest()
        self.gerChars()

root = Tk()
app = App(root)
app.pack()
app.createUI()
root.mainloop()

-------------------------------------------------------
Class2.py calling class1.py to execute UI


import class1

class ImportChar:
    def __init__(self):
        app = App(root)

    def AppendChar(self):
         code

    def RunItAll(self):
         self.ApppendChar()
         self.app.createUI()

importchar = ImportChar()
importchar.RunItAll()


-------------------------------------------------
         
-- 
View this message in context: http://www.nabble.com/Exec
uting-Tkinter-UI-from-another-class-tf3853383.html#a10916531

Sent from the Python - tkinter-discuss mailing list archive
at Nabble.com.

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discusspython.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )