[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: import doesn't work as i want
From:       "Fredrik Lundh" <fredrik () pythonware ! com>
Date:       2005-01-31 16:41:50
Message-ID: ctln3l$19h$1 () sea ! gmane ! org
[Download RAW message or body]

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> 



-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic