Table - change_submits parameter, Slider enable/disable, update.

This commit is contained in:
MikeTheWatchGuy 2018-11-10 17:26:59 -05:00
parent 418ef2ec8b
commit e78ae0424a
3 changed files with 48 additions and 9 deletions

View File

@ -1964,12 +1964,12 @@ class Slider(Element):
def Update(self, value=None, range=(None, None), disabled=None):
if value is not None:
pass
self.QT_Slider.setValue(int(value))
self.DefaultValue = value
if disabled == True:
pass
self.QT_Slider.setDisabled(True)
elif disabled == False:
pass
self.QT_Slider.setDisabled(False)
def SliderChangedHandler(self, event):
# first, get the results table built
@ -2236,7 +2236,7 @@ class Table(Element):
return
def QtCallbackCellActivated(self, value):
def QtCallbackCellActivated(self, value=None):
print('CELL ACTIVATED ', value)
# first, get the results table built
# modify the Results table in the parent FlexForm object
@ -4148,11 +4148,12 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
element.QT_TableWidget.setStyleSheet(style)
if element.ChangeSubmits:
element.QT_TableWidget.itemClicked.connect(element.QtCallbackCellActivated)
# element.QT_TableWidget.itemClicked.connect(element.QtCallbackCellActivated)
# element.QT_TableWidget.itemActivated.connect(element.QtCallbackCellActivated)
# element.QT_TableWidget.itemEntered.connect(element.QtCallbackCellActivated)
element.QT_TableWidget.itemSelectionChanged.connect(element.QtCallbackCellActivated)
# QObject::connect(ui->table->verticalHeader(), SIGNAL(sectionDoubleClicked(int)), this, SLOT( termSelect(int)));
element.QT_TableWidget.verticalHeader().connect(element.QtCallbackVerticalHeader)
# element.QT_TableWidget.verticalHeader().connect(element.QtCallbackVerticalHeader)
element.QT_TableWidget.setRowCount(len(element.Values))
element.QT_TableWidget.setColumnCount(len(element.Values[0]))
for rownum, rows in enumerate(element.Values):

View File

@ -2,7 +2,11 @@ import PySimpleGUIQt as sg
layout = [
[sg.Text('This is the new Dial Element!')],
[sg.Dial(range=(1,100), key='_DIAL_')],
[sg.T(' ', size=(70,10)), sg.T('0', key='+DIAL_VALUE+', font=('Helvetica', 15))],
[sg.Dial(range=(1,100), key='_DIAL_', change_submits=True)],
[sg.Slider((1,100), orientation='h', key='_SLIDER_', change_submits=True),
sg.T(' 1', key='+SLIDER_VALUE+', font=('Helvetica', 15))],
[sg.T('1' + 30*' ' + '100')],
[sg.Button('Show'), sg.Button('Exit')]
]
@ -10,8 +14,9 @@ window = sg.Window('Window Title').Layout(layout)
while True: # Event Loop
event, values = window.Read()
print(event, values)
if event is None or event == 'Exit':
break
window.FindElement('+DIAL_VALUE+').Update(values['_DIAL_'])
window.FindElement('+SLIDER_VALUE+').Update(values['_SLIDER_'])
window.Close()

View File

@ -0,0 +1,33 @@
import PySimpleGUIQt as sg
sg.ChangeLookAndFeel('LightGreen')
layout = [
[sg.Text('Widgets Currently Supported By PySimpleGUIQt')],
[sg.Text('Text', size=(200,35)), sg.Text('Text In Any Color/Font', font=('Courier', 15), text_color='red')],
[sg.Text('Single Line Input', size=(200,35)), sg.Input(size=(200,25))],
[sg.Text('Multi Line\nInput/Output', size=(200,60)), sg.Multiline(size=(200,75))],
[sg.Text('ListBox', size=(200,35)),sg.Listbox(['Listbox 1','Listbox 2','Listbox 3'], size=(200,85)) ],
[sg.Text('ComboBox / Dropdown', size=(200,25)),sg.Combo(['Combo item 1',], size=(200,35)) ],
[sg.Text('Spinner', size=(200,35)),sg.Spin([1,2,3], size=(40,30)) ],
[sg.Text('Checkbox', size=(200,35)), sg.Checkbox('Checkbox', change_submits=True) ],
[sg.Text('RadioButton', size=(200,35)), sg.Radio('Radio Button', 1) ],
[sg.Text('Slider', size=(200,35)), sg.Slider(orientation='h') ],
[sg.Text('Button', size=(200,35)), sg.Button('Button') ],
[sg.Text('Table', size=(200,35)), sg.Table([[0,1,3,4]])],
[sg.Text('Frame', size=(200,35)), sg.Frame('Frame',[[sg.T('')],[sg.T('')]])],
[sg.Text('Stdout Output', size=(200,35)), sg.Output(size=(200,75)) ],
[sg.Text('Dial', size=(200,35)),sg.Dial(size=(150,75)), sg.Stretch() ],
[sg.Button('Blank'), sg.Button('Exit')]
]
window = sg.Window('Window Title',
font=('Helvetica', 13)).Layout(layout)
while True: # Event Loop
event, values = window.Read()
print(event, values)
if event is None or event == 'Exit':
break
window.Close()