【无标题】

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("Visualisierungssystem für Schraubenmanagement von Chassis Vorder- und Hinterachse Aggregat")
        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\\bolt5.PNG")
        self.Lable_image = Label(self, image=self.Login_image)
        self.Lable_image.pack()

        self.Pane_right = PanedWindow(width=1700, height=1000, style="right.TPanedwindow")
        self.Pane_right.place(x=0, y=200)#250

        # 查询、TreeView
        self.Pane_right = PanedWindow(width=1800, height=480, style="right.TPanedwindow")
        self.Pane_right.place(x=0, y=180)
        # LabelFrame
        self.LabelFrame_query = LabelFrame(self.Pane_right, text="Teileinformationen suchen", width=988, height=150)
        self.LabelFrame_query.place(x=145, y=-2)
        # 添加控件
        self.Label_sno = Label(self.LabelFrame_query, text="Teilenummer:")
        self.Label_sno.place(x=10, y=20)
        self.Entry_sno = Entry(self.LabelFrame_query, width=12)
        self.Entry_sno.place(x=100, y=20)
        self.Label_name = Label(self.LabelFrame_query, text="Positionsnummer:")
        self.Label_name.place(x=357, y=20)
        self.Entry_name = Entry(self.LabelFrame_query, width=5)
        self.Entry_name.place(x=473, y=20)
        self.Label_id = Label(self.LabelFrame_query, text="Fahrzeugtyp:")
        self.Label_id.place(x=200, y=20)
        self.Entry_id = Entry(self.LabelFrame_query, width=8)
        self.Entry_id.place(x=285, y=20)
        self.Button_query = Button(self.LabelFrame_query, text="Suchen", width=8,command = self.get_query_result)
        self.Button_query.place(x=530, y=20)
        self.Button_all = Button(self.LabelFrame_query, text="Alles zeigen", width=12,command = self.load_all_student)
        self.Button_all.place(x=610, y=20)
        #添加MQB,MLB,MEB三种平台的零件装配图
        self.Button_MQB = Button(self.LabelFrame_query, text="MQB.VA", width=10,command = self.update_student)
        self.Button_MQB.place(x=720, y=5)
        self.Button_MQB1 = Button(self.LabelFrame_query, text="MQB.HA", width=10, command=self.update_student1)
        self.Button_MQB1.place(x=720, y=35)
        self.Button_MLB = Button(self.LabelFrame_query, text="MLB.VA", width=10, command=self.update_student2)
        self.Button_MLB.place(x=810, y=5)
        self.Button_MLB1 = Button(self.LabelFrame_query, text="MLB.HA", width=10, command=self.update_student3)
        self.Button_MLB1.place(x=810, y=35)
        self.Button_MEB = Button(self.LabelFrame_query, text="MEB.VA", width=10, command=self.update_student4)
        self.Button_MEB.place(x=900, y=5)
        self.Button_MEB1 = Button(self.LabelFrame_query, text="MEB.HA", width=10, command=self.update_student5)
        self.Button_MEB1.place(x=900, y=35)
        # 添加TreeView控件
        self.Tree = Treeview(self.Pane_right, columns=("sno", "names","platform","gender", "birthday","mobile","email","address","number"),show="headings", height=18)
        # 设置每一个列的宽度和对齐的方式
        self.Tree.column("sno", width=98, anchor="center")
        self.Tree.column("names", width=80, anchor="center")
        self.Tree.column("platform", width=65, anchor="center")
        self.Tree.column("gender", width=85, anchor="center")
        self.Tree.column("birthday", width=60, anchor="center")
        self.Tree.column("mobile", width=200, anchor="center")
        self.Tree.column("email", width=100, anchor="center")
        self.Tree.column("address", width=246, anchor="center")
        self.Tree.column("number", width=50, anchor="center")
        # 设置每个列的标题
        self.Tree.heading("sno", text="Teilenummer")
        self.Tree.heading("names", text="Fahrzeugtyp")
        self.Tree.heading("platform", text="Plattform")#新加
        self.Tree.heading("gender", text="VA/HA")
        self.Tree.heading("birthday", text="Positionsnummer")
        self.Tree.heading("mobile", text="Montageposition")
        self.Tree.heading("email", text="PDM-Nummer")
        self.Tree.heading("address", text="Monatgemoment")
        self.Tree.heading("number",text="Anzahl")#新加

        self.Tree.place(x=145, y=95)
        self.all_student_list = []
        self.file_path = "D:\\bolt\\demo保密版Deutsch.xls"
        self.load_file_student_info()

        data = xlrd.open_workbook("D:\\bolt\\demo保密版Deutsch.xls")
        table = data.sheets()[0]
        nrows = table.nrows
        sl = Scrollbar(self)
        Listbox(self.Tree)['yscrollcommand'] = sl.set
        sl['command'] = Listbox(self.Tree).yview

        self.Tree.bind("<Double-1>", self.view_student)
        self.Tree.bind("<Double-3>", self.view_pdm)

    def load_file_student_info(self):
        if not os.path.exists(self.file_path):
            showinfo("系统消息", "提供的文件名不存在!")
        else:
            try:
                data=xlrd.open_workbook("D:\\bolt\\demo保密版Deutsch.xls")
                table=data.sheets()[0]
                nrows=table.nrows
                for i in range(nrows):
                    if i==0:
                        continue
                    self.all_student_list.append(table.row_values(i))
            except:
                showinfo("系统消息", "文件读取出现异常!")
        # self.load_file_student_info()
        self.load_treeview(self.all_student_list)

    def load_treeview(self, current_list: list):
        # 判断是否有数据:
        if len(current_list) == 0:
            showinfo("系统消息", "没有数据加载")
        else:
            for index in range(len(current_list)):
                self.Tree.insert("", index, values=(current_list[index][0], current_list[index][1],current_list[index][2], current_list[index][3],current_list[index][4],current_list[index][5],current_list[index][6],current_list[index][7],current_list[index][8]))
        # self.load_treeview(self.all_student_list)
        self.query_result_list = []
        self.var_sno = StringVar()
        self.var_id = StringVar()
        self.var_name = StringVar()
        #textvariable = self.var_sno
        self.query_result_list.clear()
    def get_query_result(self):
        # query_condition列表中的下标为0、1分别是零件号,车型,对应的数据源中的单个数据列表的位置是0,1
        query_condition = []
        query_condition.append(self.Entry_sno.get().strip())  # 采集零件号信息
        query_condition.append(self.Entry_id.get().strip())  # 采集车型信息
        query_condition.append(self.Entry_name.get().strip())  # 采集位置标号信息
        # query_condition列表中的下标为0、1分别是零件号,车型,对应的数据源中的单个数据列表的位置是0,1
        # 准备查询条件:获取零件号
        query_condition[0] = self.Entry_sno.get()
        # 准备查询条件:获取车型
        query_condition[1] = self.Entry_id.get()
        # 准备查询条件:获取位置标号
        query_condition[2] = self.Entry_name.get()

        for item in self.all_student_list:
            if (query_condition[1] in item[1] and query_condition[0] in item[0]) and (query_condition[2] == item[4]):
                self.query_result_list.append(item)
            if (query_condition[1] in item[1] and query_condition[0] in item[0]) and (query_condition[2] == ''):
                self.query_result_list.append(item)
        # 把结果加载到TreeView中
        for i in self.Tree.get_children():
            self.Tree.delete(i)
        self.load_treeview(self.query_result_list)
    #实现显示全部数据的功能
    def load_all_student(self):
        # 加载所有的学生信息到treeview
        self.var_sno.set("")
        self.var_id.set("")
        self.var_name.set("")
        for i in self.Tree.get_children():
            self.Tree.delete(i)
        self.load_treeview(self.all_student_list)
    def load_detail_window(self):
        detail_window = detailgui.DetailWindow()
    def update_student(self):
            self.load_detail_window()
    def load_detail_window1(self):
        detail_window = detailgui1.DetailWindow()
    def update_student1(self):
        self.load_detail_window1()
    def load_detail_window2(self):
        detail_window = detailgui2.DetailWindow()
    def update_student2(self):
        self.load_detail_window2()
    def load_detail_window3(self):
        detail_window = detailgui3.DetailWindow()
    def update_student3(self):
        self.load_detail_window3()
    def load_detail_window4(self):
        detail_window = detailgui4.DetailWindow()
    def update_student4(self):
        self.load_detail_window4()
    def load_detail_window5(self):
        detail_window = detailgui5.DetailWindow()
    def update_student5(self):
        self.load_detail_window5()
    def set(self, *args):
        """Set the fractional values of the slider position (upper and
        lower ends as value between 0 and 1)."""
        self.tk.call((self._w, 'set') + args)
    #双击显示图片 如果车型是MQB并且是前轴的话,显示出MQB前轴装配图
    def view_student(self, event):
        sub_str = "MQB"
        sub_str1 = "MLB"
        sub_str2 = "MEB"
        item = self.Tree.selection()[0]#获取点击的这一行数据
        Temp_student_list = self.Tree.item(item, "values")
        if Temp_student_list[3] == 'Vorderachse':#逻辑没问题,但是不应该遍历整个表,应该看点击的数据信息的item【2】和item【3】是啥
            if Temp_student_list[2] == 'MLB':
                self.load_detail_window2()
            else:
                if Temp_student_list[2] == 'MQB':
                    self.load_detail_window()
                else:
                    self.load_detail_window4()
        else:
            if Temp_student_list[2] == 'MQB':
                self.load_detail_window1()
            else:
                if Temp_student_list[2] == 'MLB':
                    self.load_detail_window3()
                else:
                    self.load_detail_window5()

    def view_pdm(self, event):
        sub_str = '1EA.199'
        sub_str1 = '1EA.400'
        sub_str2 = '1EA.423'
        sub_str3 = '1EA.501'
        sub_str4 = '1EA.816'
        sub_str5 = '1ED.615'
        sub_str6 = '2Q0.199'
        sub_str7 = '2Q0.400'
        sub_str8 = '2Q0.423'
        sub_str9 = '2Q0.615'
        sub_str10 = '3Q0.400'
        sub_str11 = '3QF.400'
        sub_str12 = '4M0.199'
        sub_str13 = '5Q0.199'
        sub_str14 = '5Q0.400'
        sub_str15 = '5Q0.423'
        sub_str16 = '5Q0.500'
        sub_str17 = '5Q0.501'
        sub_str18 = '5Q0.615'
        sub_str19 = '8W0.400'
        sub_str20 = '8W0.501'
        sub_str21 = '8W0.615'
        sub_str22 = '80A.400'
        sub_str23 = '80A.501'
        sub_str24 = '80A.615'
        sub_str25 = '180.199'
        sub_str26 = '180.400'
        sub_str27 = '180.615'
        sub_str28 = 'TAB.017.598'
        sub_str29 = 'TAB.017.694'
        sub_str30 = '4M0.501'
        sub_str31 = '4N0.501'
        item = self.Tree.selection()[0]  # 获取点击的这一行数据
        Temp_student_list = self.Tree.item(item, "values")
        if sub_str in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.1EA.199.pdf")
        if sub_str1 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.1EA.400.pdf")
        if sub_str2 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.1EA.423.pdf")
        if sub_str3 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.1EA.501.pdf")
        if sub_str4 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.1EA.816.pdf")
        if sub_str5 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.1ED.615.pdf")
        if sub_str6 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.2Q0.199.pdf")
        if sub_str7 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.2Q0.400.pdf")
        if sub_str8 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.2Q0.423.pdf")
        if sub_str9 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.2Q0.615.pdf")
        if sub_str10 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.3Q0.400.pdf")
        if sub_str11 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.3QF.400.pdf")
        if sub_str12 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.4M0.199.pdf")
        if sub_str13 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.5Q0.199.pdf")
        if sub_str14 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.5Q0.400.pdf")
        if sub_str15 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.5Q0.423.pdf")
        if sub_str16 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.5Q0.500.pdf")
        if sub_str17 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.5Q0.501.pdf")
        if sub_str18 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.5Q0.615.pdf")
        if sub_str19 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.8W0.400.pdf")
        if sub_str20 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.8W0.501.pdf")
        if sub_str21 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.8W0.615.pdf")
        if sub_str22 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.80A.400.pdf")
        if sub_str23 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.80A.501.pdf")
        if sub_str24 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.80A.615.pdf")
        if sub_str25 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.180.199.pdf")
        if sub_str26 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.180.400.pdf")
        if sub_str27 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.180.615.pdf")
        if sub_str28 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\TAB.017.598.tif")
        if sub_str29 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\TAB.017.694.tif")
        if sub_str30 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.80A.501.pdf")
        if sub_str31 in Temp_student_list[6] :
            os.system("start explorer D:\\bolt\\PDM\\PDM.80A.501.pdf")

mainwindow = MainWindow()
mainwindow.mainloop()
from tkinter import *
from tkinter.ttk import *
import os

class DetailWindow(Toplevel):
    def __init__(self):
        super().__init__()
        self.title("MQB-Vorderachs-Montagezeichnung")
        self.geometry("1100x1100+180+80")
        self.resizable(True, True) # 能改变大小

        # 加载控件
        self.setup_UI()

    def setup_UI(self):
        # 设置style
        self.Style01 = Style()
        self.Login_image = PhotoImage(file="D:\\bolt\\MQB前.PNG")
        #self.Login_image.(100,100)
        self.Lable_image = Label(self, image=self.Login_image)
        self.Lable_image.pack()
if __name__ == '__main__':
    this_window = DetailWindow()
    this_window.mainloop()
from tkinter import *
from tkinter.ttk import *
import os

class DetailWindow(Toplevel):
    def __init__(self):
        super().__init__()
        self.title("MQB-Hinterachs-Montagezeichnung")
        self.geometry("1000x1000+180+80")
        self.resizable(True, True) # 能改变大小

        # 加载控件
        self.setup_UI()

    def setup_UI(self):
        # 设置style
        self.Style01 = Style()
        self.Login_image = PhotoImage(file="D:\\bolt\\MQB后.PNG")
        #self.Login_image.(100,100)
        self.Lable_image = Label(self, image=self.Login_image)
        self.Lable_image.pack()
if __name__ == '__main__':
    this_window = DetailWindow()
    this_window.mainloop()
from tkinter import *
from tkinter.ttk import *
import os

class DetailWindow(Toplevel):
    def __init__(self):
        super().__init__()
        self.title("MLB-Vorderachs-Montagezeichnung")
        self.geometry("1100x1100+180+80")
        self.resizable(True, True) # 能改变大小

        # 加载控件
        self.setup_UI()

    def setup_UI(self):
        # 设置style
        self.Style01 = Style()
        self.Login_image = PhotoImage(file="D:\\bolt\\MLB前.PNG")
        #self.Login_image.(100,100)
        self.Lable_image = Label(self, image=self.Login_image)
        self.Lable_image.pack()
if __name__ == '__main__':
    this_window = DetailWindow()
    this_window.mainloop()
from tkinter import *
from tkinter.ttk import *
import os

class DetailWindow(Toplevel):
    def __init__(self):
        super().__init__()
        self.title("MLB-Hinterachs-Montagezeichnung")
        self.geometry("1100x1100+180+80")
        self.resizable(True, True) # 能改变大小

        # 加载控件
        self.setup_UI()

    def setup_UI(self):
        # 设置style
        self.Style01 = Style()
        self.Login_image = PhotoImage(file="D:\\bolt\\MLB后.PNG")
        #self.Login_image.(100,100)
        self.Lable_image = Label(self, image=self.Login_image)
        self.Lable_image.pack()
if __name__ == '__main__':
    this_window = DetailWindow()
    this_window.mainloop()
from tkinter import *
from tkinter.ttk import *
import os

class DetailWindow(Toplevel):
    def __init__(self):
        super().__init__()
        self.title("MEB-Vorderachs-Montagezeichnung")
        self.geometry("1100x1100+180+80")
        self.resizable(True, True) # 能改变大小

        # 加载控件
        self.setup_UI()

    def setup_UI(self):
        # 设置style
        self.Style01 = Style()
        self.Login_image = PhotoImage(file="D:\\bolt\\MEB前.PNG")
        #self.Login_image.(100,100)
        self.Lable_image = Label(self, image=self.Login_image)
        self.Lable_image.pack()
if __name__ == '__main__':
    this_window = DetailWindow()
    this_window.mainloop()
from tkinter import *
from tkinter.ttk import *
import os

class DetailWindow(Toplevel):
    def __init__(self):
        super().__init__()
        self.title("MEB-Hinterachs-Montagezeichnung")
        self.geometry("1100x1100+180+80")
        self.resizable(True, True) # 能改变大小

        # 加载控件
        self.setup_UI()

    def setup_UI(self):
        # 设置style
        self.Style01 = Style()
        self.Login_image = PhotoImage(file="D:\\bolt\\MEB后.PNG")
        #self.Login_image.(100,100)
        self.Lable_image = Label(self, image=self.Login_image)
        self.Lable_image.pack()
if __name__ == '__main__':
    this_window = DetailWindow()
    this_window.mainloop()
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值