Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have no idea why, but copying the <a href="http://downloads.sourceforge.net/wxpython/wxPython-demo-2.8.11.0.tar.bz" rel="nofollow">wxPython demo</a> works okay.</p> <pre><code>import wx import string # my custom validator class class NumericObjectValidator(wx.PyValidator): def __init__(self): wx.PyValidator.__init__(self) self.Bind(wx.EVT_CHAR, self.OnChar) def Clone(self): return NumericObjectValidator() def Validate(self, win): tc = self.GetWindow() val = tc.GetValue() for x in val: if x not in string.digits: return False return True def OnChar(self, event): key = event.GetKeyCode() if key &lt; wx.WXK_SPACE or key == wx.WXK_DELETE or key &gt; 255: event.Skip() return if chr(key) in string.digits: event.Skip() return class SizeDialog(wx.Dialog): def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, 'Select Size', size=(200,135)) panel = wx.Panel(self, -1, size=self.GetClientSize()) sizes = map(str, range(3,21)) wx.StaticText(panel, -1, 'Rows:', pos=(10, 15)) self.rows = wx.ComboBox(panel, -1, value='8', choices=sizes, style=wx.CB_DROPDOWN, pos=(80,15), validator=NumericObjectValidator()) wx.StaticText(panel, -1, 'Columns:', pos=(10,40)) self.cols = wx.ComboBox(panel, -1, style=wx.CB_DROPDOWN, validator=NumericObjectValidator()) cancel = wx.Button(panel,wx.ID_CANCEL,'Cancel', pos=(20,75)) wx.Button(panel,wx.ID_OK,'OK', pos=(100,75)).SetDefault() def TransferToWindow(self): return True def TransferFromWindow(self): return True def get_size(self): r = int(self.rows.GetValue()) c = int(self.cols.GetValue()) return (c,r) if __name__ == "__main__": app = wx.App(0) dlg = SizeDialog(None) dlg.ShowModal() dlg.Destroy() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload