Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pynxc/waxy/button.py
diff options
context:
space:
mode:
Diffstat (limited to 'pynxc/waxy/button.py')
-rw-r--r--pynxc/waxy/button.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/pynxc/waxy/button.py b/pynxc/waxy/button.py
new file mode 100644
index 0000000..1538abc
--- /dev/null
+++ b/pynxc/waxy/button.py
@@ -0,0 +1,54 @@
+# button.py
+
+import containers
+import waxyobject
+import wx
+import styles
+
+
+class Button(wx.Button, waxyobject.WaxyObject):
+
+ __events__ = {
+ 'Click': wx.EVT_BUTTON,
+ }
+
+ def __init__(self, parent, text="", event=None, size=None,
+ tooltip="", default=False, disabled=False, **kwargs):
+ style = 0
+ style |= self._params(kwargs)
+ style |= styles.window(kwargs)
+
+ wx.Button.__init__(self, parent, wx.NewId(), text, size=size or (-1,-1),
+ style=style)
+
+ self.BindEvents()
+ if event:
+ self.OnClick = event
+
+ if tooltip:
+ self.SetToolTipString(tooltip)
+
+ if default:
+ self.SetDefault()
+
+ if disabled:
+ self.Enable(False)
+
+ styles.properties(self, kwargs)
+
+ #
+ # style parameters
+
+ __styles__ = {
+ 'align': ({
+ "left": wx.BU_LEFT,
+ "right": wx.BU_RIGHT,
+ "bottom": wx.BU_BOTTOM,
+ "top": wx.BU_TOP,
+ "exact": wx.BU_EXACTFIT,
+ }, styles.DICTSTART),
+ 'flat': (wx.NO_BORDER, styles.NORMAL),
+ # seems to have no effect on Windows XP
+ 'exactfit': (wx.BU_EXACTFIT, styles.NORMAL),
+ }
+