Merge pull request #1681 from PySimpleGUI/Dev-latest
Added Radio Button enable_events code. Will get event when radio sele…
This commit is contained in:
commit
48ab0a511d
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
version = __version__ = "0.27.0 Unreleased"
|
version = __version__ = "0.27.0.1 Unreleased"
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
|
@ -871,6 +871,11 @@ class Radio(Element):
|
||||||
super().Update(self.QT_Radio_Button, background_color=background_color, text_color=text_color, font=font, visible=visible)
|
super().Update(self.QT_Radio_Button, background_color=background_color, text_color=text_color, font=font, visible=visible)
|
||||||
|
|
||||||
|
|
||||||
|
def QtCallbackValueChanged(self, value):
|
||||||
|
if not self.ChangeSubmits:
|
||||||
|
return
|
||||||
|
element_callback_quit_mainloop(self)
|
||||||
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
super().__del__()
|
super().__del__()
|
||||||
|
@ -5107,6 +5112,7 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
||||||
qt_row_layout.addWidget(element.QT_QProgressBar)
|
qt_row_layout.addWidget(element.QT_QProgressBar)
|
||||||
# ------------------------- INPUT RADIO BUTTON element ------------------------- #
|
# ------------------------- INPUT RADIO BUTTON element ------------------------- #
|
||||||
elif element_type == ELEM_TYPE_INPUT_RADIO:
|
elif element_type == ELEM_TYPE_INPUT_RADIO:
|
||||||
|
element = element # type: Radio
|
||||||
default_value = element.InitialState
|
default_value = element.InitialState
|
||||||
element.Widget = qradio = QRadioButton(element.Text)
|
element.Widget = qradio = QRadioButton(element.Text)
|
||||||
element.QT_Radio_Button = qradio
|
element.QT_Radio_Button = qradio
|
||||||
|
@ -5136,6 +5142,9 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
||||||
|
|
||||||
QT_RadioButtonGroup.addButton(element.QT_Radio_Button)
|
QT_RadioButtonGroup.addButton(element.QT_Radio_Button)
|
||||||
|
|
||||||
|
if element.ChangeSubmits:
|
||||||
|
element.QT_Radio_Button.toggled.connect(element.QtCallbackValueChanged)
|
||||||
|
|
||||||
# qt_row_layout.setContentsMargins(*full_element_pad)
|
# qt_row_layout.setContentsMargins(*full_element_pad)
|
||||||
if element.Tooltip:
|
if element.Tooltip:
|
||||||
element.QT_Radio_Button.setToolTip(element.Tooltip)
|
element.QT_Radio_Button.setToolTip(element.Tooltip)
|
||||||
|
@ -7357,6 +7366,8 @@ def main():
|
||||||
[Menu(menu_def, key='_REALMENU_')],
|
[Menu(menu_def, key='_REALMENU_')],
|
||||||
[Text('You are running the PySimpleGUI.py file itself', font=('ANY', 15, 'Bold'), text_color='red')],
|
[Text('You are running the PySimpleGUI.py file itself', font=('ANY', 15, 'Bold'), text_color='red')],
|
||||||
[Text('You should be importing it rather than running it', font='ANY 15')],
|
[Text('You should be importing it rather than running it', font='ANY 15')],
|
||||||
|
[Text('VERSION {}'.format(__version__), text_color='red', font='ANY 24')],
|
||||||
|
|
||||||
# [Image(data_base64=logo, tooltip='Image', click_submits=True, key='_IMAGE_'),
|
# [Image(data_base64=logo, tooltip='Image', click_submits=True, key='_IMAGE_'),
|
||||||
[Frame('Input Text Group', frame1, title_color='red', tooltip='Text Group'), Stretch()],
|
[Frame('Input Text Group', frame1, title_color='red', tooltip='Text Group'), Stretch()],
|
||||||
[Frame('Multiple Choice Group', frame2, title_color='green'),
|
[Frame('Multiple Choice Group', frame2, title_color='green'),
|
||||||
|
@ -7387,13 +7398,13 @@ def main():
|
||||||
while True: # Event Loop
|
while True: # Event Loop
|
||||||
# TimerStart()
|
# TimerStart()
|
||||||
event, values = window.Read(timeout=0)
|
event, values = window.Read(timeout=0)
|
||||||
print(event) if event != TIMEOUT_KEY else None
|
print(event, values) if event != TIMEOUT_KEY else None
|
||||||
if event is None or event == 'Exit':
|
if event is None or event == 'Exit':
|
||||||
break
|
break
|
||||||
if values['_MENU_'] == 'Pause Graph':
|
if values['_MENU_'] == 'Pause Graph':
|
||||||
graph_paused = not graph_paused
|
graph_paused = not graph_paused
|
||||||
if event != TIMEOUT_KEY:
|
if event == 'About...':
|
||||||
print(event, values)
|
Popup('You are running PySimpleGUIQt', 'The version number is', version)
|
||||||
if not graph_paused:
|
if not graph_paused:
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue