[雪峰磁针石博客]python tkinter图形工具样式作业
使用tkinter绘制如下窗口
参考资料
代码
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 技术支持:https://www.jianshu.com/u/69f40328d4f0 # 技术支持 https://china-testing.github.io/ # https://github.com/china-testing/python-api-tesing/blob/master/practices/tk/tk4.py # 项目实战讨论QQ群630011153 144081101 # CreateDate: 2018-12-02 import tkinter as tk root = tk.Tk() root.configure(background='#4D4D4D') #top level styling # connecting to the external styling optionDB.txt root.option_readfile('optionDB.txt') #widget specific styling text = tk.Text( root, background='#101010', foreground="#D6D6D6", borderwidth=18, relief='sunken', width=17, height=5) text.insert( tk.END, "Style is knowing who you are,what you want to say, and not giving a damn." ) text.grid(row=0, column=0, columnspan=6, padx=5, pady=5) # all the below widgets derive their styling from optionDB.txt file tk.Button(root, text='*').grid(row=1, column=1) tk.Button(root, text='^').grid(row=1, column=2) tk.Button(root, text='#').grid(row=1, column=3) tk.Button(root, text='<').grid(row=2, column=1) tk.Button( root, text='OK', cursor='target').grid( row=2, column=2) #changing cursor style tk.Button(root, text='>').grid(row=2, column=3) tk.Button(root, text='+').grid(row=3, column=1) tk.Button(root, text='v').grid(row=3, column=2) tk.Button(root, text='-').grid(row=3, column=3) for i in range(10): tk.Button( root, text=str(i)).grid( column=3 if i % 3 == 0 else (1 if i % 3 == 1 else 2), row=4 if i <= 3 else (5 if i <= 6 else 6)) root.mainloop()
可以使用十六进制颜色代码为红色(r),绿色(g)和蓝色(b)的比例指定颜色。常用的表示是#rgb(4位),#rrggbb(8位)和#rrrgggbbb(12位)。
例如,#ff是白色,#000000是黑色,#f00是红色(R = 0xf,G = 0x0,
B = 0x0),#00ff00为绿色(R = 0x00,G = 0xff,B = 0x00),#000000fff为蓝色(R = 0x000,G = 0x000,B = 0xfff)。
或者,Tkinter提供标准颜色名称的映射。有关预定义命名颜色的列表,请访问http://wiki.tcl.tk/37701或http://wiki.tcl.tk/16166。

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
[雪峰磁针石博客]python绘图作业:使用pygame库画房子
python测试开发项目实战-目录 python工具书籍下载-持续更新 使用pygame库画如下房子 参考资料 本文最新版本地址 本文涉及的python测试开发库 谢谢点赞! 本文相关海量书籍下载 代码 #!/usr/bin/python3 # -*- coding: utf-8 -*- # 技术支持:https://www.jianshu.com/u/69f40328d4f0 # 技术支持 https://china-testing.github.io/ # https://github.com/china-testing/python-api-tesing/blob/master/practices/pygame_house.py # 项目实战讨论QQ群630011153 144081101 # CreateDate: 2018-12-01 import pygame pygame.init() screen = pygame.display.set_mode((640,480)) #used http://colorpicker.com/ to find RGB colors d...
- 下一篇
.NET redis cluster
原文: .NET redis cluster 一、下载Windows版本Redis 下载链接:https://github.com/MSOpenTech/redis/releases(根据系统选择对应版本) 二、修改默认的配置文件 如上图两个配置文件,redis.windows.conf(应用程序配置文件);redis.windows-service.conf(Redis windows 服务使用的配置文件)。 主要配置: 1. bind #IP 2.port #端口 3.loglevel #日志级别 4.logfile #日志保存位置 5.dir #数据保存地址 6.cluster-enabled yes #启用集群 7.cluster-config-file #nodes.conf (redis记录文件,自动生成) 8.cluster-node-timeout #失效时间(毫秒) 注意:以上配置节点行头不要留有空格,否则会报错。 三、准备集群配置文件 将修改好的配置文件复制如下图 四、准备集群环境 安装rubay(由于 Redis 的集群使用 ruby脚本编写,所以系统需...
相关文章
文章评论
共有0条评论来说两句吧...