当前位置:网站首页>Interface advanced actual combat (unfinished)
Interface advanced actual combat (unfinished)
2022-04-21 12:55:00 【weixin_ forty-five million seven hundred and ninety-seven thous】
Make a basic interface
import tkinter
class BaseWindowShow:
def __init__(self):
self.win=tkinter.Tk()
self.win.geometry("900x800+0+0")
def show(self):
self.win.mainloop()
Make a scrollable interface
import BigData.OutputView
import tkinter
class OutputViewList(BigData.OutputView.BaseWindowShow):# Inherit
def __init__(self,**arg):
super().__init__() # Parent class initialization
self.mylist=tkinter.Listbox(self.win,width=900,height=800)
self.scrolly=tkinter.Scrollbar(self.win)# Scroll bar
self.mylist["yscrollcommand"]= self.scrolly.set#list Scroll links
self.scrolly.pack(side=tkinter.RIGHT,fill=tkinter.Y)
self.mylist.see(40) #list Only the front 40 Are visible
self.mylist.pack()
def adddata(self,data):
self.mylist.insert(tkinter.END,data)
''' myout=OutputViewList() for i in range(200): myout.adddata(str(i)) myout.show() '''
A tabular interface
import BigData.OutputView
import tkinter
import tkinter.ttk
class OutputViewTable( BigData.OutputView.BaseWindowShow):
def __init__(self,tableheadlist,spitstr):
super().__init__()
self.table = tkinter.ttk.Treeview(self.win, height=900) # form
self.num = 0 # The starting position
self.table["columns"] = tuple(tableheadlist)# Set the header
for data in tuple(tableheadlist):# loop , Set the header
self.table.column(data, width=100)
self.table.heading(data, text=data) # Header
self.splitstr=spitstr # Cut according to what
self.tableheadlist=tableheadlist # Save list
self.table.pack(fill=tkinter.BOTH) #x, fill x,y fill y,both All filled
pass
def adddata(self,data):
lineist = tuple(data.split(self.splitstr)) # Cut and convert to tuples
if len(lineist) == len(self.tableheadlist):
self.table.insert("", self.num, text="line" + str(self.num), values=lineist)
self.num += 1
''' csdn=OutputViewTable(["user","password","email"]," # ") csdn.adddata("Fengzhongke # 04914 # [email protected]") csdn.adddata("sgry # 263021 # [email protected]") csdn.adddata("johnhawke # 39380 # [email protected]") csdn.show() '''
## Output a text interface
```python
import BigData.OutputView
import tkinter
class OutputViewText(BigData.OutputView.BaseWindowShow):
def __init__(self,**arg):
super().__init__()
self.text=tkinter.Text(self.win,width=900,height=800)
self.text.pack()
def adddata(self,data):
self.text.insert(tkinter.INSERT,data)
版权声明
本文为[weixin_ forty-five million seven hundred and ninety-seven thous]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211250440440.html
边栏推荐
- Revit secondary development - creating and switching tags (issue 16)
- SM国密学习
- 使用sql语句修复表
- 53w字!阿里首推系统性能优化指南太香了,堪称性能优化最优解
- 框架的灵魂------反射
- AES自动生成base64密钥加密解密
- In depth analysis of focal loss loss function
- What are the problems in the digital transformation of manufacturing industry
- OJ每日一练——数组倒序输出新数组
- IEEE PR for paper | 202b
猜你喜欢
随机推荐
Revit secondary development - creating grids (phase 9)
mysql数据库操作语句练习
Revit 二次开发——创建轴网(第九期)
2020 meituan (multithreading + redis)
STM32Cubemx安装
This is a small case of secondary development of phase I Revit (automatic layout of supports and hangers)
业内视频超分辨率新标杆,快手&大连理工研究登上CVPR 2022
Randomforest, a package for random forest modeling in R language
Revit二次开发——创建标高(第八期)
Revit 二次开发入门教程--用HelloRevit进行程序调试(第四期)
2022年危险化学品经营单位安全管理人员操作证考试题库模拟考试平台操作
Qfileinfo file and folder operations
使用sql语句修复表
Convert m3u8 format to MP4 through fmpeg
【贪玩巴斯】带你拿雅思Task1 小作文 7+ —— Dynamic+Static图表 & Mixed多图(Table/pie chart/line graph/bar chart)2022-4-18
程序员学习遇到的问题
Filter and listener listeners
L2-013 红色警报 (25 分)
Redis data persistence
2020batjz Android Senior Engineer Interview Questions - multiple choice questions collection (with answer analysis)









