当前位置: 首页>>代码示例>>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;未经允许,请勿转载。