Hi,
what I would like to do is to run a wxpython application from the python shell interpreter and Have the prompt to continu working on both ( wxpython frame and the interpreter ) at the same time !
so i tryed threads !
import thread
thread.start_new_thread(go,())
this function run the wxpython frame and return the prompt but the frame seems to be inactive !!
coold anybody gine me a solution plzz thanksss
I have Linux RedHat 7.1, python 2.2.1, wxpython 2.3.2.1, wxgtk 2.3.2
this is an example :
python -i test.py
import thread
thread.start_new_thread(go,())
···
from wxPython.wx import *
Create a new frame class, derived from the wxPython Frame.
class MyFrame(wxFrame):
def __init__(self, parent, id, title):
# First, call the base class' __init__ method to create the frame
wxFrame.__init__(self, parent, id, title,
wxPoint(100, 100), wxSize(160, 100))
# Associate some events with methods of this class
EVT_SIZE(self, self.OnSize)
# Add a panel and some controls to display the size and position
panel = wxPanel(self, -1)
wxStaticText(panel, -1, "Size:",
wxDLG_PNT(panel, wxPoint(4, 4)), wxDefaultSize)
self.sizeCtrl = wxTextCtrl(panel, -1, "",
wxDLG_PNT(panel, wxPoint(24, 4)),
&nb
sp; wxDLG_SZE(panel, wxSize(36, -1)),
wxTE_READONLY)
self.panel = panel
def OnSize(self, event):
size = event.GetSize()
self.sizeCtrl.SetValue("%s, %s" % (size.width, size.height))
event.Skip()
#--------------------------------------------------------------------class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "This is a test")
frame.Show(true)
self.SetTopWindow(frame)
return true
def go():
app = MyApp(0)
app.MainLoop()
Join the world�s largest e-mail service with MSN Hotmail. Click Here