I am learning python and trying out wxpython for UI development (dont have UI exp either). I have been able to create a frame with a panel, a button and a text input box. I would like to be able to enter text into the textbox and have the program do things to the text entered into the box after I click the button. Can I get some guidence as to how to do this? for example, lets say I want to display the text entered into the wx.TextCtrl control on the panel.. How would i do that?
import wx
class ExamplePanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.quote = wx.StaticText(self, label="Your quote :", pos=(20, 30))
# A button
self.button =wx.Button(self, label="Save", pos=(200, 325))
self.lblname = wx.StaticText(self, label="Your name :", pos=(20,60))
self.editname = wx.TextCtrl(self, value="Enter here your name", pos=(150, 60), size=(140,-1))
app = wx.App(False)
frame = wx.Frame(None)
panel = ExamplePanel(frame)
frame.Show()
app.MainLoop()
To do any GUI interactions you have to bind events to the widgets. You basically tell the wxPython app which method (event handler) should be called when some event (button pressed) occurs.
I would also consider learning sizers and using them for your layouts. I have changed your example a bit.