import doesn't work as i want
Fredrik Lundh
fredrik at pythonware.com
Mon Jan 31 11:41:50 EST 2005
Olivier Noblanc wrote:
> how to move in function ?
how to put code in a function? the same way you put code in a method.
change
if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = MyFrame(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
#startb = time.time() - starta
#print startb
app.MainLoop()
to
def main():
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = MyFrame(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
#startb = time.time() - starta
#print startb
app.MainLoop()
and call it from your main program:
import inc.wxgrid
inc.wxgrid.main()
if you have trouble sorting out the imports, this might help:
http://docs.python.org/ref/import.html
http://www.python.org/doc/essays/packages.html
http://effbot.org/zone/import-confusion.htm
</F>
More information about the Python-list
mailing list