当前位置: 首页>>代码示例>>Python>>正文


Python Listbox.grid_forget方法代码示例

本文整理汇总了Python中tkinter.Listbox.grid_forget方法的典型用法代码示例。如果您正苦于以下问题:Python Listbox.grid_forget方法的具体用法?Python Listbox.grid_forget怎么用?Python Listbox.grid_forget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter.Listbox的用法示例。


在下文中一共展示了Listbox.grid_forget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from tkinter import Listbox [as 别名]
# 或者: from tkinter.Listbox import grid_forget [as 别名]
class PayrollGui:

    def __init__(self):
        #database
        self.database = mysql.connector.connect(host = "123.2111.106.137", user = "root", passwd = "[email protected]")
        self.cursorObject = self.database.cursor()

        #create main window
        self.mainWindow = tkinter.Tk()
        self.mainWindow.title("Simmar-Tech Payroll System")
        self.mainWindow.resizable(1,1)
        self.mainWindow.maxsize(width = 900,height = 500)
        self.mainWindow.minsize(width = 700, height = 400)
        self.mainWindow.configure(background = "white")
        #create buttons

        self.homeButton = tkinter.Button(self.mainWindow, text = "Home", fg = "black", bg = "white",width = 25, command = self.displayHomeWindow)
        self.homeButton.grid(row = 0, column = 0,columnspan = 2)

        self.EmployeeDetailsButton = tkinter.Button(self.mainWindow, text = "Employee Details", fg = "black", bg = "white",width = 25, command = self.displayEmployeeDetailsWindow)
        self.EmployeeDetailsButton.grid(row = 0, column = 2, columnspan = 1)

        self.PayrollButton = tkinter.Button(self.mainWindow, text = "Payroll", fg = "black", bg = "white", width = 25,command = self.displayRunPayrollWindow)
        self.PayrollButton.grid(row = 0, column = 3, columnspan = 1)

        #create panels
        #home Panel
        self.newsPanel = tkinter.Label(self.mainWindow, text = "News", bg = "white")
        self.newsPanel.grid(column = 1, row = 1, columnspan = 5, rowspan = 5)
        #Add/Edit Employee Panels and field entries

        self.firstNameLabel = tkinter.Label(self.mainWindow, text='First Name:',width = 25)
        self.firstNameEntry = tkinter.Entry(self.mainWindow, text='First Name:',width = 25)

        self.middleNameLabel = tkinter.Label(self.mainWindow, text = 'Middle Names:',width = 25)
        self.middleNameEntry = tkinter.Entry(self.mainWindow, text = 'Middle Names:',width = 25)

        self.lastNameLabel= tkinter.Label(self.mainWindow, text = 'Last Name:', width = 25)
        self.lastNameEntry= tkinter.Entry(self.mainWindow, text = 'Last Name:', width = 25)

        self.genderLabel = tkinter.Label(self.mainWindow, text = 'Gender', width = 25)

        self.genderEntry = tkinter.Entry(self.mainWindow, width = 25)

        self.dateOfBirthLabel = tkinter.Label(self.mainWindow, text = 'Date of Birth', width = 25)
        self.dateOfBirthEntry = tkinter.Entry(self.mainWindow, text = 'Date of Birth', width = 25)

        self.addressLabel = tkinter.Label(self.mainWindow, text = 'Address', width = 25)
        self.addressEntry = tkinter.Entry(self.mainWindow, text = 'Address', width = 25)

        self.affiliationLabel = tkinter.Label(self.mainWindow,text = 'Affiliation', width = 25)
        self.affiliationEntry = tkinter.Entry(self.mainWindow,text = 'Affiliation', width = 25)

        self.classificationLabel = tkinter.Label(self.mainWindow, text = 'Classification', width = 25)
        self.classificationEntry = tkinter.Entry(self.mainWindow, text = 'Classification', width = 25)

        self.salaryLabel = tkinter.Label(self.mainWindow, text = 'Salary', width = 25)
        self.salaryEntry = tkinter.Entry(self.mainWindow, text = 'Salary', width = 25)

        self.hourlyRateLabel = tkinter.Label(self.mainWindow, text = 'Hourly Rate', width = 25)
        self.hourlyRateEntry = tkinter.Entry(self.mainWindow, text = 'Hourly Rate', width = 25)

        #Add/Edit Employee

        self.SearchButton = tkinter.Button(self.mainWindow, text = "Search", bg = "white", width = 25)
        self.DataField = tkinter.Entry(self.mainWindow, bg = "white", width = 60)
        self.addEmployeeButton = tkinter.Button(self.mainWindow, text = "Add Employee", bg = "white", width = 25,command = self.addEmployee)
        self.EditEmployeeButton = tkinter.Button(self.mainWindow, text = "Edit", bg = "white", width = 25)

        #List box
        self.employeeList = Listbox(self.mainWindow, width = 60, height = 10)
        self.payrollList = Listbox(self.mainWindow, width = 90, height = 20)
        #Run Payroll Window
        self.calculatePayButton = tkinter.Button(self.mainWindow, text = "Calculate Pay", bg = "white", width = 25)

        self.message = tkinter.StringVar()
        self.mainWindow.mainloop()


    def clearWindow(self):
        self.newsPanel.grid_forget()
        self.SearchButton.grid_forget()
        self.DataField.grid_forget()
        self.EditEmployeeButton.grid_forget()
        self.addEmployeeButton.grid_forget()
        self.calculatePayButton.grid_forget()
        self.employeeList.grid_forget()

        self.firstNameLabel.grid_forget()
        self.firstNameEntry.grid_forget()

        self.middleNameLabel.grid_forget()
        self.middleNameEntry.grid_forget()

        self.lastNameLabel.grid_forget()
        self.lastNameEntry.grid_forget()

        self.genderLabel.grid_forget()
        self.genderEntry.grid_forget()

#.........这里部分代码省略.........
开发者ID:iltsam,项目名称:CP2013-Assignment1,代码行数:103,代码来源:GUI2.py


注:本文中的tkinter.Listbox.grid_forget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。