Question / Enhancement
Win10, Raspian
3.7
tkinter Port, 4.20.0
4.20.0 Released 6-Jun-2020
1 years_________ Python programming experience
45 years_________ Programming experience overall
yes_________ Have used another Python GUI Framework (tkinter, Qt, etc) previously (yes/no is fine)?
My app is for a GUI on raspberry with elements updating in real time (async window)
. It's working fine, but some additional features in pysimplegui would be great:
Question1: Please provide a list with text element attributes that are updatable by window['xxkey'].update().
Question2: What is the purpose of the _f_ in window[f'xxkey'] appearing in some of your examples
Enhancement porposal: important for dynamic update me is e.g. 'border_width' on a text.
working examples:
window['K_BATT_STATE'].update('LOW')
window[f'K_BATT_V'].update(background_color='green')
not working example:
window[f'K_BATT_V'].update(border_width=2)
The documentation and the built-in doc strings tell you exactly what is available for each element's update method. Take a look at the detailed call reference.
http://calls.PySimpleGUI.org
If something's not there, then you have a couple of choices. You can directly manipulate the underlying Widget, or open an enhancement request.,
As I known
Demo_Column_Elem_Swap_Entire_Window.py
. f-string used for substring replacement by variable.One sample for you.
import PySimpleGUI as sg
layout = [[sg.Text('Hello World !', font=('Courier New',20), key='TEXT1')],
[sg.Text('dlroW olleH !', font=('Courier New',20), key='TEXT2')]]
window = sg.Window('Text', layout, finalize=True)
window['TEXT1'].Widget.configure(borderwidth=5, relief='solid')
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
break
window.close()
Thanks much Jason!
When a feature of an underlying "widget" is not exposed through the PySimpleGUI APIs, then you can use the .Widget
member variable to directly access the underlying GUI framework's widget. You lose the portability from one framework to another, but that's generally not an issue in these cases.
Glad you got a solution you're OK with.
Hi Jason, Hi Mike
Thanks a lot! Both answers are helpful ended my suffering :-) within minutes.
Pysimplegui is a great product with an incredible support!
As soon as my project is usable, I will publish it on my git account. It is an uninterruptable and high efficiency power supply for all raspberry models 3++ and pi zero and includes a complete hardware and software design.
Most helpful comment
As I known
Demo_Column_Elem_Swap_Entire_Window.py
. f-string used for substring replacement by variable.One sample for you.