當前位置: 首頁>>代碼示例>>Python>>正文


Python Notebook.config方法代碼示例

本文整理匯總了Python中ttk.Notebook.config方法的典型用法代碼示例。如果您正苦於以下問題:Python Notebook.config方法的具體用法?Python Notebook.config怎麽用?Python Notebook.config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ttk.Notebook的用法示例。


在下文中一共展示了Notebook.config方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: initUI

# 需要導入模塊: from ttk import Notebook [as 別名]
# 或者: from ttk.Notebook import config [as 別名]
    def initUI(self, students):

        note=Notebook(self.parent)



        #Tabs
        external_tab = Frame(note)
        records_tab = Frame(note)
        edit_tab = Frame(note)
        note.config()
        note.add(external_tab, text = "Attendance")
        note.add(records_tab, text="  Records  ")
        note.add(edit_tab, text="    Edit    ")


        #Create the scrollable list on the left side
        scrollbar = tk.Scrollbar(external_tab, orient="vertical")
        lb = tk.Listbox(external_tab, selectmode=MULTIPLE, width=30, height=20, yscrollcommand=scrollbar.set)
        scrollbar.config(command=lb.yview)
        scrollbar.pack(side="left", fill="y")
        lb.pack(side="left",fill="y")
        self.setList(students, lb)



        #Add dialogue box for new student
        frame1 = Frame(external_tab, relief=GROOVE, borderwidth=0)
        info_frame2 = Frame(records_tab, relief=GROOVE, borderwidth=3)
        name = tk.Entry(frame1)
        name.pack(anchor=CENTER, side=BOTTOM)
        frame1.pack(fill=BOTH, expand=1)
        self.pack(fill=BOTH, expand=1)

        #Add the buttons on the right to manipulate the list
        frame = Frame(external_tab, relief=RAISED, borderwidth=0)
        addButton = Button(frame, text="Add Student", command= lambda : self.addStudent(name.get(), lb, lb2, lb3))
        addButton.pack()
        deleteButton = Button(frame, text="Remove Student", command= lambda : self.deleteStudent(lb.curselection(), lb, lb2, lb3))
        deleteButton.pack(anchor=E, pady=20, side=RIGHT)
        frame.pack()

        markCalendarFrame = Frame(external_tab)
        self.markCalendar = Calendar.newCalendar(markCalendarFrame, True)
        markCalendarFrame.pack()

        #Add the reset button and the mark absent button
        frame2 = Frame(external_tab, relief=RAISED, borderwidth=0)
        absentButton = Button(frame2, text="Mark as Absent", command= lambda: self.markAbsent(lb.curselection()))
        absentButton.pack(side=TOP, pady=20)
        resetButton = Button(frame2, text="Reset Today's Attendance", command=self.resetDay)
        resetButton.pack(side=TOP, pady=20)
        frame2.pack(fill=BOTH, expand=1)
        self.pack(fill=BOTH, expand=1)

        #Create the Records Listbox
        scrollbar2 = tk.Scrollbar(records_tab, orient="vertical")
        lb2 = tk.Listbox(records_tab, selectmode=BROWSE, width=30, height=20, yscrollcommand=scrollbar2.set)
        scrollbar2.config(command=lb2.yview)
        scrollbar2.pack(side="left", fill="y")

        #Bind a click to finding attendance
        lb2.bind('<<ListboxSelect>>', self.getTotals)
        lb2.pack(side="left",fill="y")
        self.setList(students, lb2)

        #Create the text that updates in real time based on selection

        self.present_variable.set('')
        self.absent_variable.set('')
        info_frame = Frame(records_tab, relief=GROOVE, borderwidth=3)
        present_setup = tk.Message(records_tab, anchor=W, justify=CENTER, width=100, text="Days Present: ")
        present_setup.pack(fill=X, side=TOP)
        present_message = tk.Message(records_tab, anchor=E, justify=CENTER, width=100, textvariable= self.present_variable)
        present_message.pack(fill=X, side=TOP)
        info_frame.pack(side=TOP)




        absent_setup = tk.Message(records_tab, anchor=W, justify=CENTER, width=100, text="Days Absent: ")
        absent_setup.pack(fill=X, side=TOP)
        absent_variable = tk.Message(records_tab, anchor=E, justify=CENTER, width=100, textvariable= self.absent_variable)
        absent_variable.pack(fill=X, side=TOP)
        info_frame2.pack(side=TOP)



        #Create a see Calendar Button
        # calendarButton = Button(records_tab, text="See Specific Days", command= lambda : self.setStudentCalendar(lb2.curselection()))
        # calendarButton.pack(side=TOP)


        calendar_frame = Frame(records_tab, relief=GROOVE, borderwidth=3, width = 300)
        self.theCalendar = Calendar.newCalendar(calendar_frame, False)
        calendar_frame.pack(side=TOP, pady = 20)

        clearCalendarButton = Button(records_tab, text="Clear Calendar", command=self.clearStudentCalendar)
        clearCalendarButton.pack(side=TOP)

#.........這裏部分代碼省略.........
開發者ID:Grindlemire,項目名稱:AttendanceKeeper,代碼行數:103,代碼來源:main.py


注:本文中的ttk.Notebook.config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。