[visionegg] wxPython question
- From: Christoph Lehmann <lehmann@xxxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Tue, 26 Aug 2003 09:30:26 +0200
dear Andrew
Since I believe, that this must be very easy to resolve, means you know
it in 5sec:
I want to open a simple dialog box before the VE screen =
get_default_screen() call
in this dialog I want to get just an integer (subject-id) (and later on
a file (by means of the wxPython filedialog)..
I succeeded in creating the dialog (see below) but I cannot get the
subject-id info out of this code (I assume subjid should be declared
either as global var or return it as return value from the dialog).
can you tell me how to get this out of the dialog code?
and: if you know a simpler way of how to show the dialog box , instead
of:
app = wxPySimpleApp()
frame = wxFrame(None, -1, " Subject Identification")
Form1(frame,-1)
frame.Show(1)
app.MainLoop()
I would be grateful. Is there nothing similiar like :
dlg = MyDialog(subjid)
if dlg.ShowModal() != wxID_CANCEL:
subjid = dlg.MyGetValue()
# do something with dlg's data...
dlg.Destroy()
? would be nice. I don't like the way of using app.MainLoop() etc.
---here my simple wxPython code before the screen = get_default_screen()
call:
from wxPython.wx import *
subid = ""
class Form1(wxPanel):
def __init__(self, parent, id):
wxPanel.__init__(self, parent, id)
# A button
self.button =wxButton(self, 10, "Ok", wxPoint(300, 60 ))
EVT_BUTTON(self, 10, self.OnClick)
# the edit control - one line version.
self.lblname = wxStaticText(self, -1, "Enter subject ID
:",wxPoint(20,60))
self.editname = wxTextCtrl(self, 20, "0", wxPoint(150, 60),
wxSize(140,-1))
EVT_TEXT(self, 20, self.EvtText)
def OnClick(self,event):
subjid = event.GetString()
self.Destroy()
def EvtText(self, event):
subjid = event.GetString()
app = wxPySimpleApp()
frame = wxFrame(None, -1, " Subject Identification")
Form1(frame,-1)
frame.Show(1)
app.MainLoop()
# ==
screen = get_default_screen()
..now the ususal VE code
many thanks
christoph
--
Christoph Lehmann <lehmann@xxxxxxxxxxxx>
University Hospital of Clinical Psychiatry
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- Follow-Ups:
- [visionegg] Re: wxPython question
- From: Sol Simpson
Other related posts:
- » [visionegg] wxPython question
- » [visionegg] Re: wxPython question
- » [visionegg] Re: wxPython question
- » [visionegg] Re: wxPython question
- [visionegg] Re: wxPython question
- From: Sol Simpson