
上QQ阅读APP看书,第一时间看更新
1-3 窗口属性的设置
下列是与窗口相关的方法。

程序实例ch1_2.py:设置窗口标题为MyWindow,同时设置宽是300,高是160。

执行结果
上述第7行使用bg设置了窗口背景颜色,相关颜色名称可以参考附录A。除了可以使用名称直接设置色彩外,还可以使用十六进制方式设置色彩的RGB值,其中每个色彩用两个十六进制数字表示。从附录A的色彩表也可以看到RGB数值所代表的颜色。

程序实例ch1_3.py:使用mystar.ico更改系统默认的图标,同时使用另一种更改背景颜色的方法。

执行结果
