Bootstrap

python制作窗口界面_Python GUI项目实战:主窗体的界面设计与实现

一、基础

from tkinter import *

from tkinter.ttk import *

import os

class MainWindow(Tk):

def __init__(self):

super().__init__()

self.title("

显示效果:

注意:tkinter在Mac上Panedwindow不支持修改前景色背景色

1597200311-1833-27103e044e4afc5b9bfdcca280c..jpg?v=1597200311

二、添加查询区域

在右边的Pannedwindow容器中,添加一个LabelFrame容器作为查询区域,在LabelFrame容器中添加一系列的Label、Entry、Button控件,可以输入学号、姓名、电话、身份证、查询、和显示全部信息:

self.Pane_right = PanedWindow(width=725, height=540, style="right.TPanedwindow")

self.Pane_right.place(x=170, y=94)

# LabelFrame

self.LabelFrame_query = LabelFrame(self.Pane_right,text = "学生信息查询",width = 700,height = 70)

self.LabelFrame_query.place(x = 10 , y = 10)

# 添加控件

self.Label_sno = Label(self.LabelFrame_query,text = "学号:")

self.Label_sno.place(x = 5,y = 13)

self.Entry_sno = Entry(self.LabelFrame_query,width = 8)

self.Entry_sno.place(x = 40,y = 10)

self.Label_name = Label(self.LabelFrame_query, text="姓名:")

self.Label_name.place(x=125, y=13)

self.Entry_name = Entry(self.La

;