2

我想通过使用 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")

我尝试使用弹出方法。然而这一次,在弹出窗口中写的东西变成了标题栏的名称

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

在此处输入图像描述

那么我怎样才能打印这些东西,并且可以随意命名标题栏。

谢谢。

注意:我可以接受使用 tkinter 提供的解决方案,但我更喜欢 pysimpleguı

4

1 回答 1

2

在 PySimpleGUI 中,要设置标题栏文本时要查找的参数是title. 所有的弹出窗口都像Window对象一样有一个标题参数。

这个弹出窗口有一个标题:

在此处输入图像描述

用于制作它的代码是:

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

您可以在主文档http://www.PySimpleGUI.org中找到弹出参数的描述。

于 2019-12-06T15:28:59.577 回答