SoFunction
Updated on 2024-10-29

python implementation of a simple study room seat reservation system

I'm just learning python, so if you have any questions, I'd love to be corrected!

0 Effect

Seat selection box

在这里插入图片描述

在这里插入图片描述

1 On the required library

The Python environment requires the following python packages to be installed:

  • PySide2
  • datetime
  • json
  • argparse

2 About the seat selection box

The number of tables in the selection box, their size, their style and the position of each chair is variable, for example we can change the color of the tables and whether they have rounded corners or not:

在这里插入图片描述

This relies heavily on the information within, displayed below:

{
    "tableNum": 6,
    "tablePos": [
        [0.02,0.15],
        [0.35,0.15],
        [0.68,0.15],
        [0.02,0.65],
        [0.35,0.65],
        [0.68,0.65]
    ],
    "tableSize": [
        [0.25,0.2],
        [0.25,0.2],
        [0.25,0.2],
        [0.25,0.2],
        [0.25,0.2],
        [0.25,0.2]
    ],
    "tableType": [
        0,1,2,0,0,0
    ],
    "tableSS": [
        "QLabel{background: rgb(245,245,245);color:rgb(92,92,92);border-radius:50px;border: 3px solid rgb(142,142,142)}",
        "QLabel{background: rgb(245,245,245);color:rgb(92,92,92);border: 3px solid rgb(142,142,142)}",
        "QLabel{background: rgb(221,217,195);color:rgb(92,92,92);border: 3px solid rgb(142,142,142)}"
    ],
    "tableId": [
        "A","B","C","D","E","F"
    ],
    "chairNum": [
        6,6,6,6,6,6
    ],
    "chairPos": [
        [
            [0.04,-0.08],
            [0.105,-0.08],
            [0.17,-0.08],
            [0.04,0.21],
            [0.105,0.21],
            [0.17,0.21]
        ],
        [
            [0.04,-0.08],
            [0.105,-0.08],
            [0.17,-0.08],
            [0.04,0.21],
            [0.105,0.21],
            [0.17,0.21]
        ],[
            [0.04,-0.08],
            [0.105,-0.08],
            [0.17,-0.08],
            [0.04,0.21],
            [0.105,0.21],
            [0.17,0.21]
        ],[
            [0.04,-0.08],
            [0.105,-0.08],
            [0.17,-0.08],
            [0.04,0.21],
            [0.105,0.21],
            [0.17,0.21]
        ],[
            [0.04,-0.08],
            [0.105,-0.08],
            [0.17,-0.08],
            [0.04,0.21],
            [0.105,0.21],
            [0.17,0.21]
        ],[
            [0.04,-0.08],
            [0.105,-0.08],
            [0.17,-0.08],
            [0.04,0.21],
            [0.105,0.21],
            [0.17,0.21]
        ]
    ],
    "chairSize": [
        0.032,0.07
    ],
    "chairSS_W": "background: rgb(242,242,242);border-radius:15px;border: 3px solid rgb(74,69,42)",
    "chairSS_K": "background: rgb(64,64,64);border-radius:15px;border: 3px solid rgb(74,69,42)",
    "chairSS_R": "background: rgb(149,55,43);border-radius:15px;border: 3px solid rgb(74,69,42)",
    "mapSize": [
        2,2
    ]
}

3 Information on application forms and seat occupancy

Since it is only for the purpose of simulating the process, the present application form as well as the seat occupancy are stored in and respectively:

3.1 :

"[[\"A1\", \"A2\", \"A3\", \"A4\", \"A5\", \"A6\", \"B1\", \"B2\", \"B3\", \"B4\", \"B5\", \"B6\", \"C1\", \"C2\", \"C3\", \"C4\", \"C5\", \"C6\", \"D1\", \"D2\", \"D3\", \"D4\", \"D5\", \"D6\", \"E1\", \"E2\", \"E3\", \"E4\", \"E5\", \"E6\", \"F1\", \"F2\", \"F3\", \"F4\", \"F5\", \"F6\"], [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"1816000XXXX\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"], [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"temp\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]]"

3.2 :

"{\"A1\": false, \"A2\": false, \"A3\": false, \"A4\": false, \"A5\": false, \"A6\": false, \"B1\": false, \"B2\": false, \"B3\": false, \"B4\": false, \"B5\": false, \"B6\": false, \"C1\": false, \"C2\": false, \"C3\": false, \"C4\": true, \"C5\": false, \"C6\": false, \"D1\": false, \"D2\": false, \"D3\": false, \"D4\": false, \"D5\": false, \"D6\": false, \"E1\": false, \"E2\": false, \"E3\": false, \"E4\": false, \"E5\": false, \"E6\": false, \"F1\": false, \"F2\": false, \"F3\": false, \"F4\": false, \"F5\": false, \"F6\": false}"

4 About command-line arguments

We use command line code to simulate the swipe process, and we also set up command line code for booking an appointment and requesting a hold:

4.1 slotCard_in

Python slotCard_in.py -i="XXXXXXXXXXX"
Python slotCard_in.py --student-

4.2 slotCard_out

Python slotCard_out.py -i="XXXXXXXXXXX"
Python slotCard_out.py --student-

4.3 cmd_order

'''
TEST CODE:
--------------------------------
see Map:
Python cmd_order.py
--------------------------------
order seat: 
Python cmd_order.py -i="XXXXXXXXXXX" -n="xxx" -s="A1"

-h   --help         show the help message and exit
-i   --student-id   student id
-n   --student-name student name
-s   --seatPos      seat id  
'''

4.4 cmd_leave

'''
TEST CODE:
----------------------------------------------
leave for temp
Python cmd_leave.py -i="XXXXXXXXXXX" -t="temp"
----------------------------------------------
leave
Python cmd_leave.py -i="XXXXXXXXXXX" -t="free"  
[or]
Python cmd_leave.py -i="XXXXXXXXXXX" 

-h   --help         show the help message and exit
-i   --student-id   student id
-t   --leave-type   temp/free 
'''

5 About command-line output

5.1 cmd_order Reservation

> Python cmd_order.py
[seat]============================
Reservable Seats:

 ▇ A2 A3 A4 A5 A6
 B1 B2 B3 B4 B5 B6
 C1 C2 C3 C4 C5 C6
 D1 D2 D3 D4 D5 D6
 E1 E2 E3 E4 E5 E6
 F1 F2 F3 F4 F5 F6

> Python cmd_order.py -i="18160000000" -n="xxx" -s="A1"
[book error]========================
Seats are taken.,Please select another location to apply

> Python cmd_order.py -i="18160000000" -n="xxx" -s="A100"
[book error]========================
Incorrect seat number format

> Python cmd_order.py -i="18160000000" -n="xxx" -s="A2"
[book]===========================================
2021-05-31 18:04:35
name and surname:xxx
student number:18160000000
seat (in theater):A2
Reservation Success!
-------------------------------------------------
caveat:
1、Reservation Success后请在30Arrive within minutes,Otherwise, the reservation information will be invalidated。
2、Please swipe your campus card to verify your information before entering the study room.。
3、If you want to leave, pleasecmdRun the following code:
   Python cmd_leave.py -i='XXXXXXXXXXX' -t='temp'
4、take off、To cancel an appointment, pleasecmdRun the following code:
   Python cmd_leave.py -i='XXXXXXXXXXX' -t='free'

> Python cmd_order.py -i="18160000000" -n="xxx" -s="A3"
[book error]========================
Please do not double book

5.2 slotCard_in Swipe to enter

> Python slotCard_in.py -i="1816000XXXX"
[in error]==========================
Non-University Campus Card or Time-Out

> Python slotCard_in.py -i="18160000000"
[in]================================
Reservation Time:2021-05-31 18:04:35
campus card number:18160000000
seat (in theater):A2

5.3 cmd_leave Request to Leave or Temporary Leave

> Python cmd_leave.py -i="1816000XXXX" -t="temp"
[out error]=========================
Wrong campus card number may have been entered

> Python cmd_leave.py -i="18160000000" -t="temp"
[out]===============================
Application for temporary departure has been made

> Python cmd_leave.py -i="18160000000" -t="free"
[out]===============================
Released position

5.4 slotCard_out Swipe card to leave or suspend

> Python slotCard_out.py -i="18160000000"
[out]===============================
respite:2021-05-31 18:23:09
campus card number:18160000000
seat (in theater):A1

> Python slotCard_out.py -i="1816000XXXX"
[out error]=========================
Please try again with a different card

6 About the interface code

6.1

from  import QApplication, QWidget,QScrollArea
from  import QLabel,QPushButton,QLineEdit
from  import QIcon,QFont
from  import Qt
import sys
("...")
import json
import datetime
from orderDataDisplay import orderDisplay
from InfOperate import occupySeat,order,timeoutDetection,alreadyOreder


class Window_main(QWidget):
    def __init__(self,Width=700,Height=840):
        super().__init__() 
        ("book seat online")
        timeoutDetection()

        =Width
        =Height
        =""
        =[]
        ="./gallery/"

        # Font Tags
        title_qf=QFont()
        title_qf.setPointSize(11)
        title_qf.setBold(True)
        title_qf.setFamily("Cambria")
        main_qf=QFont()
        main_qf.setPointSize(27)
        main_qf.setBold(True)
        main_qf.setFamily("Cambria")
        Inf_qf=QFont()
        Inf_qf.setPointSize(10)
        Inf_qf.setBold(True)
        Inf_qf.setFamily("Cambria")
        table_qf=QFont()
        table_qf.setPointSize(16)
        table_qf.setBold(True)
        table_qf.setFamily("Cambria")
        # ---
        self.QF_part_title=title_qf         # box title font label
        self.QF_main_title=main_qf          # main headline font tags
        self.QF_state_explain=Inf_qf        # status tags explain text font tags
        self.QF_Inf_title=title_qf          # message headline font tag
        self.QF_Inf_text=Inf_qf             # message text font labels
        self.QF_table_name=table_qf         # Table numbering info tags

        # Stylesheets
        self.SS_part_frame="QLabel{background: rgb(245,245,245);color:rgb(92,92,92);border-radius:8px;border: 2.5px solid rgb(122,122,122)}"
        self.SS_part_title="QLabel{background: rgb(245,245,245);color:rgb(92,92,92)}"
        self.SS_main_title="QLabel{background: rgb(245,245,245);color:rgb(92,92,92);border-radius:50px;border: 3px solid rgb(142,142,142)}"
        self.SS_state_frame="QLabel{background: rgb(245,245,245);border-radius:5px;border: 3px solid rgb(172,172,172)}"
        self.SS_W="QLabel{background: rgb(242,242,242);border-radius:9px;border: 3px solid rgb(74,69,42)}"
        self.SS_K="QLabel{background: rgb(64,64,64);border-radius:9px;border: 3px solid rgb(74,69,42)}"
        self.SS_R="QLabel{background: rgb(149,55,43);border-radius:9px;border: 3px solid rgb(74,69,42)}"
        self.SS_state_explain="QLabel{background: rgb(214,219,233);color:rgb(92,92,92)}"
        self.SS_Inf_title="QLabel{background: rgb(230,230,230);color:rgb(82,82,82);border-radius:8px}"
        self.SS_text_Line="QLineEdit{border-radius:3px;background: rgb(205,205,205);color:rgb(82,82,82)}"
        self.SS_book_btn="color:rgb(255,255,255);background: rgb(79,148,204)"

        # path=[0]
        # path=path[0:("/")]
        f=open("./config/","r")
        seatInf=(f)
        f=open("./config/","r")
        seatOccupied=(f)
        =seatInf
        =(seatOccupied)

        ()
        ()
        ()
        ()
        ()
        ()
        ()    
    # ================================================================================================
    # Callback function section:
    def selectedPos(self):# Seat selection callbacks
        btn=()
        tempSelectedId=("chairId")
        if not [tempSelectedId]:
            if len()==0:
                =tempSelectedId
                =btn
                (["chairSS_R"])
                (" Current selection: "+tempSelectedId)
            else:
                (["chairSS_W"])
                =btn
                (["chairSS_R"])
                =tempSelectedId
                (" Current selection: "+tempSelectedId)

    def bookSeat(self):
        if not len()==0:
            if alreadyOreder(self.InfBox_Id.text()):
                print("================================")
                print("Please do not double book.")
                print(" ")
            else:
                nowDate=()
                nowDateStr=('%Y-%m-%d %H:%M:%S')
                print("================================")
                print(nowDateStr)
                print("Name:"+self.InfBox_Name.text())
                print("School number:"+self.InfBox_Id.text())
                print("Seating:"+)
                print(" ")
                # ()
                # app = ()
                # if app is None: 
                #     app = QApplication()
                self.window_disp= orderDisplay(self.InfBox_Name.text(),
                            self.InfBox_Id.text(),
                            nowDateStr,
                            ,700,840)
                self.window_disp.show()
                ()

                occupySeat()
                order(self.InfBox_Id.text(),nowDateStr,)

            
            


    # ================================================================================================
    # Framework constructor section:
    def setSize(self):# Resize the frame
        (80,80,,)
        (,)
        (,)

    def setIcon(self):# Setting icons
        appIcon=QIcon()
        (appIcon)

    def setStateExp(self):# Drawing the status explanation box
        Width=
        Height=
        self.part0=QLabel(self)
        self.(0.66*Width,0.045*Height,
                               0.28*Width,0.14*Height)
        self.(self.SS_state_frame)

        # ---Color Bar--------------------------------------------------------------------
        self.CB1=QLabel(self)
        self.(0.68*Width,0.06*Height,0.05*Width,0.03*Height)
        self.(self.SS_W) 
        self.CB2=QLabel(self)
        self.(0.68*Width,(0.06+0.04)*Height,0.05*Width,0.03*Height)
        self.(self.SS_K) 
        self.CB3=QLabel(self)
        self.(0.68*Width,(0.06+0.08)*Height,0.05*Width,0.03*Height)
        self.(self.SS_R) 

        # ---Color Bar Explanatory Text -------------------------------------------------------------
        self.plaintext1=QLabel(self)
        self.(0.76*Width,(0.059)*Height,0.15*Width,0.032*Height)
        self.(self.SS_state_explain)
        self.(" Optional")
        self.(self.QF_state_explain)
        self.plaintext2=QLabel(self)
        self.(0.76*Width,(0.059+0.04)*Height,0.15*Width,0.032*Height)
        self.(self.SS_state_explain)
        self.(" Elected.")
        self.(self.QF_state_explain)
        self.plaintext3=QLabel(self)
        self.(0.76*Width,(0.059+0.08)*Height,0.15*Width,0.032*Height)
        self.(self.SS_state_explain)
        self.(" Current Selection ")
        self.(self.QF_state_explain)

    def setInfBox(self):
        Width=
        Height=
        # --- Message title ------------------------------------------
        self.InfTitle_Name=QLabel(self)
        self.InfTitle_Name.setGeometry(0.09*Width,0.28*Height,
                                       0.16*Width,0.05*Height)
        self.InfTitle_Name.setStyleSheet(self.SS_Inf_title)
        self.InfTitle_Name.setText(" Name:")
        self.InfTitle_Name.setFont(self.QF_Inf_title)
        # ---
        self.InfTitle_Id=QLabel(self)
        self.InfTitle_Id.setGeometry(0.09*Width,0.36*Height,
                                     0.16*Width,0.05*Height)
        self.InfTitle_Id.setStyleSheet(self.SS_Inf_title)
        self.InfTitle_Id.setText(" School number:")
        self.InfTitle_Id.setFont(self.QF_Inf_title)

        # --- Info text box ------------------------------------------
        self.InfBox_Name=QLineEdit(self) 
        self.InfBox_Name.setText("Example: Li Hua") 
        self.InfBox_Name.move(0.3*Width,0.281*Height)  
        self.InfBox_Name.resize(0.6*Width,0.048*Height)
        self.InfBox_Name.setFont(self.QF_Inf_text)
        self.InfBox_Name.setStyleSheet(self.SS_text_Line)
        #self.InfBox_Name.()

        self.InfBox_Id=QLineEdit(self) 
        self.InfBox_Id.setText("Example: XXXXXXXXXXXXXX") 
        self.InfBox_Id.move(0.3*Width,0.361*Height)  
        self.InfBox_Id.resize(0.6*Width,0.048*Height)
        self.InfBox_Id.setFont(self.QF_Inf_text)
        self.InfBox_Id.setStyleSheet(self.SS_text_Line)
        #self.InfBox_ID.()

    def partition(self):# Mapping the distribution of box lines
        Width=
        Height=
        # ---- Title Box ---------------------------------------------------
        self.part0=QLabel(self)
        self.(0.05*Width,0.045*Height,
                               0.52*Width,0.14*Height)
        self.(self.SS_main_title)
        self.()
        self.(" Study room reservations.")
        self.(self.QF_main_title)
        # self.part0title=QLabel(self)
        # self.(0.098*Width,0.06*Height,
        #                             0.43*Width,0.11*Height)
        # self.(self.SS_part_title)
        # self.(" Study room reservation")
        # self.(self.QF_main_title)
        
        # ---- Information fill-in box -----------------------------------------------
        self.part1=QLabel(self)
        self.(0.04*Width,0.23*Height,
                               0.92*Width,0.24*Height)
        self.(self.SS_part_frame)
        self.part1title=QLabel(self)
        self.(0.08*Width,0.21*Height,
                                    0.15*Width,0.04*Height)
        self.(self.SS_part_title)
        self.("Filling in information")
        self.(self.QF_part_title)
    
        # --- Seat selection box ------------------------------------------------
        self.part2=QLabel(self)
        self.(0.04*Width,0.53*Height,
                               0.92*Width,0.355*Height)
        self.(self.SS_part_frame)
        self.part1title=QLabel(self)
        self.(0.08*Width,0.51*Height,
                                    0.15*Width,0.04*Height)
        self.(self.SS_part_title)
        self.(" Seat Selection ")
        self.(self.QF_part_title)
        # ================================================================================================
        # Slidable area section:
    def setMap(self):
        Width=
        Height=
        =QScrollArea(self)
        (0.05*Width,0.545*Height,
                             0.9*Width,0.325*Height)
        ()
        ()


    def drawMap(self):# Seat mapping
        =QWidget(self)   
        boxWidth=0.9*
        boxHeight=0.325*
        
        seatInf=
        seatOccupied=
        

        mapWidth=boxWidth*seatInf["mapSize"][0]
        mapHeight=boxHeight*seatInf["mapSize"][1]
        tableSize=seatInf["tableSize"]
        tablePos=seatInf["tablePos"]
        chairSize=seatInf["chairSize"]
        chairPos=seatInf["chairPos"]

        (0,0,mapWidth,mapHeight) 
        (mapWidth,mapHeight)
        (mapWidth,mapHeight)
        
        for i in range(0,seatInf["tableNum"]):
            table=QLabel()
            (tablePos[i][0]*mapWidth,tablePos[i][1]*mapHeight,
                              tableSize[i][0]*mapWidth,tableSize[i][1]*mapHeight)
            (seatInf["tableId"][i])
            (self.QF_table_name)
            ()
            (seatInf["tableSS"][seatInf["tableType"][i]])
            for j in range(0,seatInf["chairNum"][i]):
                chairBnt=QPushButton()
                ((tablePos[i][0]+chairPos[i][j][0])*mapWidth,
                                     (tablePos[i][1]+chairPos[i][j][1])*mapHeight,
                                     chairSize[0]*mapWidth,
                                     chairSize[1]*mapHeight)

                chairId=seatInf["tableId"][i]+str(j+1)
                if seatOccupied[chairId]:
                    (seatInf["chairSS_K"])
                else:
                    (seatInf["chairSS_W"])

                ("chairId",chairId)
                ()

    def setBookBtn(self):
        Width=
        Height=
        =QLabel(self)
        (0.54*Width,(0.92)*Height,0.22*Width,0.05*Height)
        (self.SS_state_explain)
        (" Current selection:")
        (self.QF_Inf_title)
        
        =QPushButton(self)
        (0.79*Width,(0.92)*Height,0.16*Width,0.05*Height)
        (self.SS_book_btn)
        ("Make an appointment.")
        (self.QF_Inf_title)
        ()
# ===========================================================================================
# function call:
myapp = QApplication()
window_main = Window_main(700,840)
window_main.show()
(myapp.exec_())

6.2

from  import QApplication, QWidget
from  import QLabel,QPushButton
from  import QIcon,QFont,QPixmap
from  import Qt
import sys
("...")
import datetime
from InfOperate import freeSeat,setString

class Window_disp(QWidget):
    def __init__(self,studentName,studentId,bookTime,seatId,Width=700,Height=840):
        super().__init__() 
        ("order successfully")
        

        =studentName
        =studentId
        =bookTime
        =seatId
        =Width
        =Height

        # path=[0]
        # path=path[0:("/")]
        ="./gallery/order_succ_title.png"
        ="./gallery/"

        # Font Tags
        title_qf=QFont()
        title_qf.setPointSize(11)
        title_qf.setBold(True)
        title_qf.setFamily("Cambria")
        Inf_qf=QFont()
        Inf_qf.setPointSize(10)
        Inf_qf.setBold(True)
        Inf_qf.setFamily("Cambria")
        matters_qf=QFont()
        matters_qf.setPointSize(10.5)
        matters_qf.setBold(True)
        matters_qf.setFamily("Cambria")
        # ---
        self.QF_part_title=title_qf         # box title font label
        self.QF_Inf_title=title_qf          # message headline font tag
        self.QF_Inf_text=Inf_qf             # message text font labels
        self.QF_matters=matters_qf          # Notes font tags

        # Stylesheets
        self.SS_part_frame="QLabel{background: rgb(245,245,245);color:rgb(92,92,92);border-radius:8px;border: 2.5px solid rgb(122,122,122)}"
        self.SS_part_title="QLabel{background: rgb(245,245,245);color:rgb(92,92,92)}"
        self.SS_Inf_title="QLabel{background: rgb(230,230,230);color:rgb(82,82,82);border-radius:8px}"
        self.SS_text_Line="QLabel{border-radius:3px;background: rgb(205,205,205);color:rgb(82,82,82)}"
        self.SS_book_btn="color:rgb(255,255,255);background: rgb(79,148,204)"

        ()
        ()
        ()
        ()
        ()
        ()
        ()
    # ================================================================================================
    # Callback function section:
    def tempLeave(self):
        if ()=="Temporary departure.":
            setString(,"temp")
            nowDate=()
            nowDateStr=('%Y-%m-%d %H:%M:%S')
            self.InfBox_Time.setText(nowDateStr) 
            ("In the process of leaving.")

    def leave(self):
        freeSeat()
        ()



    # ================================================================================================
    # Framework constructor section:
    def setSize(self):# Resize the frame
        (80,80,,)
        (,)
        (,)

    def setIcon(self):# Setting icons
        appIcon=QIcon()
        (appIcon)

    def setTitle(self):
        Width=
        Height=
        =QLabel(self)
        (0.24*Width,0.02*Height,
                                0.52*Width,0.18*Height)
        =QPixmap()
        =(0.52*Width,0.18*Height)
        ()

    def partition(self):# Mapping the distribution of box lines
        Width=
        Height=
        # ----Info Display Box -----------------------------------------------
        self.part1=QLabel(self)
        self.(0.04*Width,0.23*Height,
                               0.92*Width,0.40*Height)
        self.(self.SS_part_frame)
        self.part1title=QLabel(self)
        self.(0.08*Width,0.21*Height,
                                    0.15*Width,0.04*Height)
        self.(self.SS_part_title)
        self.(" Personal information ")
        self.(self.QF_part_title)
        # - Notes box -----------------------------------------------
        self.part2=QLabel(self)
        self.(0.04*Width,0.67*Height,
                               0.92*Width,0.22*Height)
        self.(self.SS_part_frame)
        self.part2title=QLabel(self)
        self.(0.08*Width,0.65*Height,
                                    0.15*Width,0.04*Height)
        self.(self.SS_part_title)
        self.(" Cautions ")
        self.(self.QF_part_title)

    def InfDisplay(self):
        Width=
        Height=
        # --- Message title ------------------------------------------
        self.InfTitle_Name=QLabel(self)
        self.InfTitle_Name.setGeometry(0.09*Width,0.28*Height,
                                       0.16*Width,0.05*Height)
        self.InfTitle_Name.setStyleSheet(self.SS_Inf_title)
        self.InfTitle_Name.setText(" Name:")
        self.InfTitle_Name.setFont(self.QF_Inf_title)
        # ---
        self.InfTitle_Id=QLabel(self)
        self.InfTitle_Id.setGeometry(0.09*Width,0.36*Height,
                                     0.16*Width,0.05*Height)
        self.InfTitle_Id.setStyleSheet(self.SS_Inf_title)
        self.InfTitle_Id.setText(" School number:")
        self.InfTitle_Id.setFont(self.QF_Inf_title)
        # ---
        self.InfTitle_Time=QLabel(self)
        self.InfTitle_Time.setGeometry(0.09*Width,0.44*Height,
                                     0.16*Width,0.05*Height)
        self.InfTitle_Time.setStyleSheet(self.SS_Inf_title)
        self.InfTitle_Time.setText(" Time:")
        self.InfTitle_Time.setFont(self.QF_Inf_title)
        # ---
        self.InfTitle_Seat=QLabel(self)
        self.InfTitle_Seat.setGeometry(0.09*Width,0.52*Height,
                                     0.16*Width,0.05*Height)
        self.InfTitle_Seat.setStyleSheet(self.SS_Inf_title)
        self.InfTitle_Seat.setText(" Seat: ")
        self.InfTitle_Seat.setFont(self.QF_Inf_title)

        # --- Info text box ------------------------------------------
        self.InfBox_Name=QLabel(self) 
        self.InfBox_Name.setText() 
        self.InfBox_Name.move(0.3*Width,0.281*Height)  
        self.InfBox_Name.resize(0.6*Width,0.048*Height)
        self.InfBox_Name.setFont(self.QF_Inf_text)
        self.InfBox_Name.setStyleSheet(self.SS_text_Line)
        self.InfBox_Name.setAlignment()
        # ---
        self.InfBox_Id=QLabel(self) 
        self.InfBox_Id.setText() 
        self.InfBox_Id.move(0.3*Width,0.361*Height)  
        self.InfBox_Id.resize(0.6*Width,0.048*Height)
        self.InfBox_Id.setFont(self.QF_Inf_text)
        self.InfBox_Id.setStyleSheet(self.SS_text_Line)
        self.InfBox_Id.setAlignment()
        # ---
        self.InfBox_Time=QLabel(self) 
        self.InfBox_Time.setText() 
        self.InfBox_Time.move(0.3*Width,0.441*Height)  
        self.InfBox_Time.resize(0.6*Width,0.048*Height)
        self.InfBox_Time.setFont(self.QF_Inf_text)
        self.InfBox_Time.setStyleSheet(self.SS_text_Line)
        self.InfBox_Time.setAlignment()
        # ---
        self.InfBox_Seat=QLabel(self) 
        self.InfBox_Seat.setText() 
        self.InfBox_Seat.move(0.3*Width,0.521*Height)  
        self.InfBox_Seat.resize(0.6*Width,0.048*Height)
        self.InfBox_Seat.setFont(self.QF_Inf_text)
        self.InfBox_Seat.setStyleSheet(self.SS_text_Line)
        self.InfBox_Seat.setAlignment()

    def mattersDisplay(self):
        Width=
        Height=
        self.m1=QLabel(self) 
        self.("1. Please arrive within 30 minutes after the reservation is made or the reservation information will be invalidated.") 
        self.(0.06*Width,0.71*Height,
                            0.87*Width,0.03*Height)
        self.("QLabel{color:rgb(82,82,82)}")
        self.(self.QF_matters)

        self.m2=QLabel(self) 
        self.("2. Please swipe your campus card to verify your information before entering the study hall.") 
        self.(0.06*Width,0.75*Height,
                            0.87*Width,0.03*Height)
        self.("QLabel{color:rgb(82,82,82)}")
        self.(self.QF_matters)

        self.m3=QLabel(self) 
        self.("3. If you want to leave, please click the "Leave" button below, otherwise the seat information will be released.") 
        self.(0.06*Width,0.79*Height,
                            0.87*Width,0.03*Height)
        self.("QLabel{color:rgb(82,82,82)}")
        self.(self.QF_matters)

        self.m4=QLabel(self) 
        self.("4. To leave or cancel an appointment, please click on the "Leave\Cancel" button below.") 
        self.(0.06*Width,0.83*Height,
                            0.87*Width,0.03*Height)
        self.("QLabel{color:rgb(82,82,82)}")
        self.(self.QF_matters)

    def setBtn(self):
        Width=
        Height=
        =QPushButton(self)
        (0.18*Width,(0.92)*Height,0.2*Width,0.05*Height)
        (self.SS_book_btn)
        ("Temporary departure.")
        (self.QF_Inf_title)
        ()

        Width=
        Height=
        =QPushButton(self)
        ((1-0.2-0.18)*Width,(0.92)*Height,0.2*Width,0.05*Height)
        (self.SS_book_btn)
        ("Leave \ Cancel")
        (self.QF_Inf_title)
        ()

# ===========================================================================================
# function call:
# myapp = QApplication()
# window_disp = Window_disp("Li Hua", "1816000XXXX", "2021-05-30 17:04:24", "A1",700,840)
# window_disp.show()
# myapp.exec_()


def orderDisplay(studentName,studentId,bookTime,seatId,Width=700,Height=840):
    window_disp = Window_disp(studentName,studentId,bookTime,seatId,Width,Height)
    return window_disp

-1 Posterior note

Full code, json file, image material, md file download link below, please read the file for detailed description:more-table_jb51.rar

This article on the python implementation of a simple study room seat reservation system is introduced to this article, more related python study room seat reservation content please search for my previous posts or continue to browse the following related articles I hope you will support me in the future!