This isn't you actual source code is it? Where do you load the controls
from wxDesigner onto the dialog? FindWindowById is not a standalone
fucntion, you probably need a "self." in front of it.
I have the folowing in TerminalDlg.py
from control_wdr import *
class TerminalDlg(wxDialog):
def __inti__(self, parent, id, title,pos=wxPyDefaultPosition,
size=wxPyDefaultSize, style=wxDEFAULT_DIALOG_STYLE ):
wxDialog.__init__(self, parent, id, title, pos, size, style )
text = self.FindWindowById(ID_INSTRUCCION_TEXTCTRL)
text.SetValue("HOLA")
def GetInstruccionTextCtrl(self):
return self.FindWindowById(ID_INSTRUCCION_TEXTCTRL)
def GetCodigoTextCtrl(self):
return self.FindWindowById(ID_CODIGO_TEXTCTRL)
def GetHandleTextCtrl(self):
return wxPyTypeCast(self.FindWindowById(ID_HANDLE_TEXTCTRL),
"wxTextCtrl")
def GetParametros0TextCtrl(self):
return self.FindWindowById(ID_PARAMETROS0_TEXTCTRL)
def GetParametros1TextCtrl(self):
return self.FindWindowById(ID_PARAMETROS1_TEXTCTRL)
def GetComandoTextCtrl(self):
return self.FindWindowById(ID_COMANDO_TEXTCTRL)
def GetRespuestaTextCtrl(self):
return wxPyTypeCast(self.FindWindowById(ID_RESPUESTA_TEXTCTRL),
"wxTextCtrl")
control_wdr.py is the file generated by wxDesigner with the control.
The main program is the followwing:
from wxPython.wx import *
from control_wdr import *
from TerminalDlg import *
class MyFrame(wxFrame):
def __init__(self, parent, id, title,
pos = wxPyDefaultPosition, size = (600,600),
style = wxDEFAULT_FRAME_STYLE):
wxFrame.__init__(self, parent, id, title, pos, size, style)
self.CreateMyMenuBar()
self.CreateMyToolBar()
self.CreateStatusBar(1)
self.SetStatusText("Control difractmetro")
# insert main window here
# WDR: handler declarations for MyFrame
EVT_MENU(self, ID_ABOUT, self.OnAbout)
EVT_MENU(self, ID_QUIT, self.OnQuit)
EVT_MENU(self, ID_ABRIR, self.OnMenuArchivoAbrir)
EVT_MENU(self, ID_TERMINAL, self.OnMenuEjecutarTerminal)
EVT_MENU(self, ID_ALINEAMIENTO, self.OnMenuTerminalAlineamiento)
EVT_CLOSE(self, self.OnCloseWindow)
# WDR: methods for MyFrame
def CreateMyMenuBar(self):
self.SetMenuBar(CreateMyMenuBarFunc())
def CreateMyToolBar(self):
tb = self.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER)
MyToolBarFunc(tb)
# WDR: handler implementations for MyFrame
def OnAbout(self, event):
dialog = wxMessageDialog(self, "Copyright 2002\n"
"Zunbeltz Izaola\n"
"wmbizazz@lg.ehu.es","About
Control",
wxOK>wxICON_INFORMATION)
dialog.CentreOnParent()
dialog.ShowModal()
def OnQuit(self, event):
self.Close(true)
def OnCloseWindow(self, event):
self.Destroy()
def OnMenuArchivoAbrir(event):
dlg = wxFileDialog(self, "Abrir Archivo", "", "","Todos(*.*)|*.*",
wxOPEN,wxDefault)
if dlg.ShowModal() == wxID_OK:
self.project_open(dlg.GetPath())
dlg.Destroy()
def OnMenuEjecutarTerminal(self, event):
dialog = TerminalDlg(self, -1, "Terminal")
TerminalDialogFunc(dialog, true)
dialog.ShowModal()
dialog.Destroy()
def OnMenuTerminalAlineamiento(self, event):
pass
···
#------------------------------------------------------------
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "control")
frame.Show(true)
self.SetTopWindow(frame)
return true
#------------------------------------------------------------
app = MyApp(0)
app.MainLoop()
The problem is that when the TerminalDlg dialog aperar, I thik the HOLA,
text should aperar in the TextCtrl identifaied with
ID_INSTRUCCION_TEXTCTRL, but there is no text at all. Any idea?
Zunbeltz
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org