栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python tkinter图形工具样式作业

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python tkinter图形工具样式作业

使用tkinter绘制如下窗口

图片.png

参考资料
  • 本文最新版本地址

  • 本文涉及的python测试开发库 谢谢点赞!

  • 本文相关海量书籍下载

  • https://github.com/CoderDojoSV/beginner-python

代码
#!/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-02import tkinter as tk
root = tk.Tk()
root.configure(background='#4D4D4D')  #top level styling# connecting to the external styling optionDB.txtroot.option_readfile('optionDB.txt')#widget specific stylingtext = 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 filetk.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 styletk.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)。



作者:python作业AI毕业设计
链接:https://www.jianshu.com/p/7c3948db3b47


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/221658.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号