Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PySimpleGui Output Title Bar Name Problem

I want to print an output something like this by using pysimplegui

import PySimpleGUI as sg
print("The age of the universe is", age_of_universe, "Gyr")
print("The age of universe at z = ", z, "is", age_of_universe_at_z,)
print("Lookback time is", lookback_time , "Gyr")
print("Comoving distance to an object at z =", z , "is" , comoving_distance, "Mpc")
print("Luminosity distance to an object at z =", z, "is", luminosity_distance, "Mpc")
print("Angular diameter distance to an object at z =", z, "is", angular_distance, "Mpc")

I tried to use the popup method. However this time the thing that written inside the popup becomes the name of the title bar

sg.popup('This is the modified LightGreen3 Theme', 'It has black button text')

enter image description here

So how can I print these things and can name the title bar whatever I want.

Thanks.

Note: I can accept solutions offered by using tkinter but I prefer pysimpleguı

like image 893
Layla Avatar asked Nov 27 '25 23:11

Layla


1 Answers

In PySimpleGUI the parameter to look for when you want to set the titlebar text is title. All of the popups have a title parameter like the Window object does.

This popup window has a title:

enter image description here

the code used to make it is:

sg.popup('This is a popup.....Make sure it is long enough to see title.', title='My own title')

You can find a description of the popup parameters in the main documentation, http://www.PySimpleGUI.org.

like image 58
Mike from PSG Avatar answered Nov 30 '25 11:11

Mike from PSG



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!