Python/wxPython/wx.TextCtrl

From Fundamental Ramen
< Python‎ | wxPython
Revision as of 09:59, 4 December 2019 by Tacoball (talk | contribs) (→‎Python)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

XRC Example

Python - OnInit()

self.wxtc = wx.xrc.XRCCTRL(self.frame, 'name_of_wxtc', 'wxTextCtrl')
self.wxtc.Bind(wx.EVT_KEY_UP, self.OnKeyPress, id=wx.xrc.XRCID('name_of_wxtc'))

Python - Event Handling

def OnKeyPress(self, event):
  if event.GetKeyCode() == 13:
    self.the_text = self.wxtc.GetValue()
    self.frame.Close()

XRC

<object name="name_of_wxtc" class="wxTextCtrl">
  <size>200,25</size>
</object>

Programmatically Example

# TODO

Documents