第一次接触python的tkinter库
程序代码:
from tkinter import *
from tkinter.ttk import *
import os
import xlrd
import detailgui
import detailgui1
import detailgui2
import detailgui3
import detailgui4
import detailgui5
import win32api
import win32con
for i in range(1,1500):
win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL,0,0,-1)
#driver.maximize_window() #将浏览器最大化显示
class MainWindow(Tk):
def __init__(self):
super().__init__()
self.title("底盘前后轴总成螺栓管理可视化系统")
self.geometry("1300x900+200+100")
self.resizable(True, True)#self.resizable(0,0)
self["bg"] = "lavender"#lavender
self.setup_UI()
#light steel blue
#lavender
def setup_UI(self):
# 设定Style
self.Style01 = Style()
# self.Style01.configure("left.TPanedwindow", background="sky blue")
self.Style01.configure("right.TPanedwindow", background="lavender")#lavender
self.Style01.configure("TButton", width=3, font=("宋体", 10,"normal") )
# Top_banner
self.Login_image = PhotoImage(file="D:\\bolt\\bolt.PNG")
self.Lable_image = Label(self, image=self.Login_image)
self.Lable_image.pack()
self.Pane_right = PanedWindow(width=1400, height=1000, style="right.TPanedwindow")
self.Pane_right.place(x=0, y=200)#250
# 查询、TreeView
self.Pane_right = PanedWindow(width=1700, height=480, style="right.TPanedwindow")
self.Pane_right.place(x=0, y=180)
# LabelFrame
self.LabelFrame_query = LabelFrame(self.Pane_right, text="零件信息查询", width=967, height=150)
self.LabelFrame_query.place(x=145, y=-2)
# 添加控件
self.Label_sno = Label(self.LabelFrame_query, text="零件号:")
self.Label_sno.place(x=10, y=20)
self.Entry_sno = Entry(self.LabelFrame_query, width=12)
self.Entry_sno.place(x=65, y=20)
self.Label_name = Label(self.LabelFrame_query, text="位置标号:")
self.Label_name.place(x=290, y=20)
self.Entry_name = Entry(self.LabelFrame_query, width=5)
self.Entry_name.place(x=360, y=20)
self.Label_id = Label(self.LabelFrame_query, text="车型:")
self.Label_id.place(x=170, y=20)
self.Entry_id = Entry(self.LabelFrame_query, width=8)
self.Entry_id.place(x=215, y=20)
self.Button_query = Button(self.LabelFrame_query, text="查询", width=8,command = self.get_query_result)
self.Button_query.place(x=450, y=20)
self.Button_all = Button(self.LabelFrame_query, text="显示全部", width=10,command = self.load_all_student)
self.Button_all.place(x=550, y=20)
#添加MQB,MLB,MEB三种平台的零件装配图
self.Button_MQB = Button(self.LabelFrame_query, text="MQB.FA", width=10,command = self.update_student)
self.Button_MQB.place(x=680, y=5)
self.Button_MQB1 = Button(self.LabelFrame_query, text="MQB.RA", width=10, command=self.update_student1)
self.Button_MQB1.place(x=680, y=35)
self.Button_MLB = Button(self.LabelFrame_query, text="MLB.FA", width=10