Python tkinter模板

tkinter

import tkinter as tk
import tkinter.messagebox
from tkinter import Menu, BOTH
from tkinter import ttk
import time
import settings
import mysql_conn as sql
import re

def main():

win = tkinter.Tk()
win.title(“A11_MES”)
sw = win.winfo_screenheight()
sh = win.winfo_screenwidth()

win.geometry("%dx%d+%d+%d" %(1600, 850, (sw-1600)/2, (sh-850)/2))

win.geometry("%dx%d" %(1600, 850))
tab0 = tk.Frame(win)
tab0.pack(expand=1, fill=BOTH)
tab1 = tk.Frame(win)
tab2 = tk.Frame(win)
tab3 = tk.Frame(win)
tab4 = tk.Frame(win)

tk.Label(tab0, text=“登入界面”, bg="#FF62BC").place(relx=0.0, rely=0.5, relwidth=1, relheight=0.1)
tk.Label(tab1, text=“过站系统”, bg="#FF62BC").place(relx=0.0, rely=0.5, relwidth=1, relheight=0.1)
tk.Label(tab2, text=“排产系统”, bg="#FF62BC").place(relx=0.0, rely=0.5, relwidth=1, relheight=0.1)
tk.Label(tab3, text=“工站查询”, bg="#FF62BC").place(relx=0.0, rely=0.5, relwidth=1, relheight=0.1)
tk.Label(tab4, text=“过站明细”, bg="#FF62BC").place(relx=0.0, rely=0.5, relwidth=1, relheight=0.1)

def to_tab1():
tab0.forget()
tab2.forget()
tab3.forget()
tab4.forget()
tab1.pack(expand=1, fill=BOTH)

def to_tab2():
tab0.forget()
tab1.forget()
tab3.forget()
tab4.forget()
tab2.pack(expand=1, fill=BOTH)

def to_tab3():
tab0.forget()
tab1.forget()
tab2.forget()
tab4.forget()
tab3.pack(expand=1, fill=BOTH)

def to_tab4():
tab0.forget()
tab1.forget()
tab2.forget()
tab3.forget()
tab4.pack(expand=1, fill=BOTH)

def bind_F1(self):
to_tab1()

def bind_F2(self):
to_tab2()

def bind_F3(self):
to_tab3()

def bind_F4(self):
to_tab4()

win.bind(’’, bind_F1)
win.bind(’’, bind_F2)
win.bind(’’, bind_F3)
win.bind(’’, bind_F4)

menubar = Menu(win)
win.config(menu=menubar)
menu2 = tkinter.Menu(menubar, tearoff

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值