Hello and thanks for being here.
I am boB and I am not new to python but I am very new to wxpython. I am trying to do what I thought was a simple project but I am having lots of problems. I am now thinking this may be an initial design issue. I have a frame with a panel as a child. The panel has statictext and textctrls and 3 buttons. I am trying to have the user enter some text to find in a text entry dialog box and then use that to continue. I can get the text but I am stuck there. I am then trying to access the textctrls to put info in them and I can’t. Most of this is going on inside a function that starts the find process. I have some sample code below. Let me know if you need more.
Thanks,
import wx
class wxinfo(wx.Frame):
def __init__(self, parent, title):
super(wxinfo, self).__init__(parent, title=title, size=(500, 400))
self.InitUI()
.
.
.
def InitUI(self):
.
.
.
panel = wx.Panel(self)
sizer = wx.GridBagSizer(4, 4)
text1 = wx.StaticText(panel, label="The Question:")
sizer.Add(text1, pos=(1, 0), flag=wx.TOP|wx.LEFT|wx.BOTTOM, border=5)
.
.
.
tc1 = wx.TextCtrl(panel)
sizer.Add(tc1, pos=(1, 1), span=(1, 4), flag=wx.EXPAND|wx.LEFT|wx.RIGHT, border=5)
.
.
.
button2 = wx.Button(panel, label=“Find Rec”, size=(90, 28))
button2.Bind(wx.EVT_BUTTON, self.OnClickBut2)
.
.
.
def OnClickBut2(self, e):#click Find button
#put dialog here to get find text
finddlg = wx.TextEntryDialog(self, ‘Enter text to find’, ‘Text to find’)
if finddlg.ShowModal() == wx.ID_OK:
gotit = finddlg.GetValue()
panel.tc2.SetValue(gotit)#no good
#self.statusbar.SetStatusText("gotit is = " + gotit)
finddlg.Destroy()