NEW demo program - SDK Quick Reference
This commit is contained in:
		
							parent
							
								
									5b83e16202
								
							
						
					
					
						commit
						10ec6a11ae
					
				
					 1 changed files with 85 additions and 0 deletions
				
			
		
							
								
								
									
										85
									
								
								Demo_PSG_SDK_Quick_Ref.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								Demo_PSG_SDK_Quick_Ref.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,85 @@ | ||||||
|  | import PySimpleGUI as sg | ||||||
|  | 
 | ||||||
|  | element_list = ('Text', | ||||||
|  |                 'InputText', | ||||||
|  |                 'CheckBox', | ||||||
|  |                 'RadioButton', | ||||||
|  |                 'Listbox', | ||||||
|  |                 'Slider', | ||||||
|  |                 'Multiline', | ||||||
|  |                 'Output', | ||||||
|  |                 'ProgressBar', | ||||||
|  |                 'OptionMenu', | ||||||
|  |                 'Menu', | ||||||
|  |                 'Frame', | ||||||
|  |                 'Column', | ||||||
|  |                 'Graph', | ||||||
|  |                 'Image', | ||||||
|  |                 'Table', | ||||||
|  |                 'Tab', | ||||||
|  |                 'TabGroup') | ||||||
|  | 
 | ||||||
|  | desc_text = """ | ||||||
|  | Text(   text | ||||||
|  |         size=(None, None) | ||||||
|  |         auto_size_text=None | ||||||
|  |         click_submits=None | ||||||
|  |         relief=None | ||||||
|  |         font=None | ||||||
|  |         text_color=None | ||||||
|  |         background_color=None | ||||||
|  |         justification=None | ||||||
|  |         pad=None | ||||||
|  |         key=None | ||||||
|  |         tooltip=None)""" | ||||||
|  | 
 | ||||||
|  | desc_inputtext = """ | ||||||
|  | InputText(  default_text ='' | ||||||
|  |             size=(None, None) | ||||||
|  |             auto_size_text=None | ||||||
|  |             password_char='' | ||||||
|  |             justification=None | ||||||
|  |             background_color=None | ||||||
|  |             text_color=None | ||||||
|  |             font=None | ||||||
|  |             tooltip=None | ||||||
|  |             do_not_clear=False | ||||||
|  |             key=None | ||||||
|  |             focus=False | ||||||
|  |             pad=None) | ||||||
|  | """ | ||||||
|  | 
 | ||||||
|  | desc_checkbox = """ | ||||||
|  | CheckBox(   text, | ||||||
|  |             default=False | ||||||
|  |             size=(None, None) | ||||||
|  |             auto_size_text=None | ||||||
|  |             font=None | ||||||
|  |             background_color=None | ||||||
|  |             text_color=None | ||||||
|  |             change_submits=False | ||||||
|  |             key=None | ||||||
|  |             pad=None | ||||||
|  |             tooltip=None) | ||||||
|  | """ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | descriptions = {'Text':desc_text, 'InputText':desc_inputtext, 'CheckBox':desc_checkbox} | ||||||
|  | 
 | ||||||
|  | layout = [[sg.Text('Persistent window')], | ||||||
|  |           [sg.Listbox(values=element_list, size=(15,len(element_list)), key='_in_', change_submits=True), | ||||||
|  |            sg.Text(desc_text, size=(40,15),font=('Consolas 13'), key='_out_')], | ||||||
|  |           [sg.RButton('Read'), sg.Exit()]] | ||||||
|  | 
 | ||||||
|  | window = sg.Window('Window that stays open').Layout(layout) | ||||||
|  | 
 | ||||||
|  | while True: | ||||||
|  |     button, values = window.Read() | ||||||
|  |     if button is None or button == 'Exit': | ||||||
|  |         break | ||||||
|  |     element = values['_in_'][0] | ||||||
|  |     try: | ||||||
|  |         desc = descriptions[element] | ||||||
|  |     except: desc = '' | ||||||
|  |     window.FindElement('_out_').Update(desc) | ||||||
|  |     print(button, values) | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue