Skip to content

Commit 6859c4a

Browse files
authored
Merge pull request #12 from alankilborn/pushlike
Add pushbutton appearance for radio buttons
2 parents 78a4a5f + 046c2d5 commit 6859c4a

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

helper/WinDialog/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"""
5656

5757
__all__ = ['Dialog',
58-
'Button', 'DefaultButton', 'CheckBoxButton', 'GroupBox', 'CommandButton', 'RadioButton', 'SplitButton',
58+
'Button', 'DefaultButton', 'CheckBoxButton', 'GroupBox', 'CommandButton', 'RadioButton', 'RadioPushButton', 'SplitButton',
5959
'Label', 'TruncatedLabel', 'BlackFramedLabel', 'CenteredLabel', 'RigthAlignedLabel',
6060
'ComboBox', 'ComboBoxEx', 'ListBox', 'TextBox', 'ListView', 'ProgressBar', 'StatusBar', 'UpDown', 'TreeView'
6161
]
@@ -76,7 +76,7 @@
7676
LPWINDOWPOS
7777
)
7878
from .controls.__control_template import Control
79-
from .controls.button import Button, DefaultButton, CheckBoxButton, GroupBox, CommandButton, RadioButton, SplitButton
79+
from .controls.button import Button, DefaultButton, CheckBoxButton, GroupBox, CommandButton, RadioButton, RadioPushButton, SplitButton
8080
from .controls.label import Label, TruncatedLabel, BlackFramedLabel, CenteredLabel, RigthAlignedLabel
8181
from .controls.combobox import ComboBox, ComboBoxEx
8282
from .controls.listbox import ListBox

helper/WinDialog/controls/button.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,37 @@ class RadioButton(Button):
337337
style: int = Control.style | WS.TABSTOP | BS.AUTORADIOBUTTON | BS.FLAT
338338

339339

340+
@dataclass
341+
class RadioPushButton(Button):
342+
'''
343+
Represents a radio button control with a pushbutton-like appearance.
344+
345+
The RadioPushButton class inherits from the Button class.
346+
347+
Attributes:
348+
Inherited Attributes:
349+
See :class:`Button`
350+
351+
Methods:
352+
getCheckState() -> BST:
353+
Gets the state of the radio pushbutton control.
354+
355+
setCheckState():
356+
Sets the state of the radio pushbutton control.
357+
358+
Example Usage:
359+
from dialog_controls import RadioPushButton
360+
361+
# Create a radio button control with a pushbutton appearance
362+
radio = RadioPushButton(title="Enable Option", size=(120, 20), position=(10, 10))
363+
364+
Note:
365+
The RadioPushButton class inherits the onClick, onPaint, onHilite, onUnhilite,
366+
onDisable, onDoubleClicked, onSetFocus, and onKillFocus attributes from the Button class.
367+
'''
368+
style: int = Control.style | WS.TABSTOP | BS.AUTORADIOBUTTON | BS.FLAT | BS.PUSHLIKE
369+
370+
340371
@dataclass
341372
class SplitButton(Button):
342373
'''

0 commit comments

Comments
 (0)