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


Python Treeview.pack方法代码示例

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


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

示例1: MainWindow

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
class MainWindow(Frame):
    """
    Macro class for the main program window
    """
    def __init__(self, parent):

        Frame.__init__(self, parent)

        self.parent = parent
        self.parent.title('PyNBTx %s' % __version__)

        self.style = Style()
        self.style.theme_use('default')
        self.style.configure('TButton', padding=0)

        self.pack(fill=BOTH, expand=1)

        self.menu = MainMenu(root)
        self.toolbar = ToolBar(self)
        self.tree = Treeview(self, height=20)
        self.tree_display = TreeDisplay(self.tree)

        self.ui_init()

    def ui_init(self):
        root['menu'] = self.menu
        self.toolbar.pack(anchor=NW, padx=4, pady=4)
        self.tree.column('#0', width=300)
        self.tree.pack(fill=BOTH, anchor=NW, padx=4, pady=4)
开发者ID:ievans3024,项目名称:PyNBTx,代码行数:31,代码来源:__init__.py

示例2: Mk_Book_display

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
def Mk_Book_display(book, name):
    w = book.page(name)
    disp = Frame(w)

    tree_columns = ('book_no', 'book_name', 'book_author', 'book_publisher', 'in_out_status')
    Entries=Treeview(   disp,
                        columns=tree_columns,
                        show="headings"
                    )


    global_bucket['book_shelf'] = Entries

    vsb = Scrollbar (   disp,
                        orient="vertical",
                        command=Entries.yview)
    Entries.configure(yscrollcommand=vsb.set)
    for col,width in zip(tree_columns,(4,20,10,5,6)):
        Entries.heading(col, text=col.title(), anchor='w')
        Entries.column(col, width=1)

    vsb.pack(side=RIGHT,fill=Y)
    Entries.pack(fill=BOTH, expand=1)
    disp.pack(fill=BOTH, expand=1)

    update()
开发者ID:peruraj,项目名称:Intelligent_library,代码行数:28,代码来源:frontend.py

示例3: _maketree

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
def _maketree(parent_tree, wallpapers, conf):
    tree = Treeview(parent_tree)
    i = 0
    if conf['type'] == 'workspace':
        for workspace, wallpaper_files in wallpapers.items():
            i += 1
            index = str(i)
            tree.insert('', 'end', index, text=workspace)
            for j, wallpaper_file in enumerate(wallpaper_files):
                inner_index = index + '_' + str(j)
                tree.insert(index, 'end', inner_index, text=wallpaper_file)
    elif conf['type'] == 'desktop':
        for wallpaper_file in wallpapers:
            i += 1
            index = str(i)
            tree.insert('', 'end', index, text=wallpaper_file)
    tree.pack()
开发者ID:fernandoenzo,项目名称:wallpapoz,代码行数:19,代码来源:wallpapoz_main_window.py

示例4: DataTree

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
class DataTree(Frame):
    def __init__(self, master):
        Frame.__init__(self, master, bg="black")
        scroll = Scrollbar(self)

        self.tree = Treeview(self, yscrollcommand=scroll.set)
        scroll.config(command=self.tree.yview)

        self.items = []

        self.tree.pack(side=LEFT, fill=BOTH, expand=1)
        scroll.pack(side=LEFT, fill=Y)

    def update(self, files):
        self.files = files

        # reversing, since removing a node with children removes the children as
        # well. there might be a cleaner way to do this by clearing each of the
        # file nodes, but that might add more burden to the garbage collector
        # down the line.
        for item in reversed(self.items):
            self.tree.delete(item)

        self.items = []

        for (i, datafile) in enumerate(self.files):
            self.add_file(datafile, i)

    def add_file(self, f, f_id):
        file_id = self.tree.insert("", "end", text=f.name)
        self.items.append(file_id)

        self.add_node(file_id, f.data, f_id)

    def add_node(self, p, node, f_id):
        if node.name != '':
            node_id = self.tree.insert(p, "end", text=node.name,
                                       values=(f_id, node.path))
            self.items.append(node_id)
        else:
            node_id = p

        if node.is_grp:
            for child in node.children:
                self.add_node(node_id, child, f_id)
开发者ID:youngmit,项目名称:spectacuplot,代码行数:47,代码来源:DataTree.py

示例5: Table

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
class Table(Frame):
    def __init__(self, parent, title, columns):
        Frame.__init__(self, parent)
        self.pack(expand=YES, fill=BOTH)

        self.title_lbl = Label(self, text=title, font=GENERAL_FONT)
        self.table_tree = Treeview(self, columns=columns)

        # добавить Scrollbar
        self.scroll = Scroll(self, orient=VERTICAL, command=self.table_tree.yview)
        self.table_tree['yscroll'] = self.scroll.set

        for i in range(len(columns)):
            self.table_tree.heading(columns[i], text=columns[i])

        self.place_widgets()

    def place_widgets(self):
        self.title_lbl.pack(side=TOP, fill=X, expand=YES)
        self.table_tree.pack(side=LEFT, fill=BOTH, expand=YES)
        self.scroll.pack(side=RIGHT, fill=Y, expand=YES)
开发者ID:fargelus,项目名称:SAPR,代码行数:23,代码来源:generaltable.py

示例6: Window

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
class Window(Tk):
    def __init__(self):
        super().__init__()
        self.title('Treepace Tree Transformation GUI Demo')
        self.geometry('640x400')
        self.resizable(False, False)
        self.tree_frame = Frame()
        self.tree_button = Button(self.tree_frame, text="Load tree",
                                  command=self.load)
        self.tree_button.pack(expand=True, fill=BOTH)
        self.tree_text = Text(self.tree_frame, width=20)
        self.tree_text.pack(expand=True, fill=BOTH)
        self.tree_text.insert('1.0', DEFAULT_TREE)
        self.tree_frame.pack(side=LEFT, expand=True, fill=BOTH)
        
        self.program_frame = Frame()
        self.program_button = Button(self.program_frame, text="Transform",
                                     command=self.transform)
        self.program_button.pack(expand=True, fill=BOTH)
        self.program_text = Text(self.program_frame, width=60, height=8)
        self.program_text.pack(expand=True, fill=BOTH)
        self.program_text.insert('1.0', DEFAULT_PROGRAM)
        self.tv = Treeview(self.program_frame)
        self.tv.pack(expand=True, fill=BOTH)
        self.program_frame.pack(side=LEFT, expand=True, fill=BOTH)

        GuiNode.tv = self.tv
        self.load()
    
    def load(self):
        if self.tv.exists('root'):
            self.tv.delete('root')
        program = self.tree_text.get('1.0', END)
        self.tree = Tree.load(program, IndentedText, GuiNode)
    
    def transform(self):
        try:
            self.tree.transform(self.program_text.get('1.0', END))
        except Exception as e:
            messagebox.showerror("Transformation error", e)
开发者ID:sulir,项目名称:treepace,代码行数:42,代码来源:gui.py

示例7: Mk_Status_display

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
def Mk_Status_display(book, name):
    w = book.page(name)
    disp = Frame(w)

    tree_columns = ('book_no', 'book_name', 'date', 'staff_id', 'staff_name', 'note')
    Entries=Treeview(   disp,
                        columns=tree_columns,
                        show="headings",
                    )

    global_bucket['status_register'] = Entries

    vsb = Scrollbar (   disp,
                        orient="vertical",
                        command=Entries.yview)
    Entries.configure(yscrollcommand=vsb.set)
    for col in tree_columns:
        Entries.heading(col, text=col.title(), anchor='w')
        Entries.column(col, width=0)
    vsb.pack(side=RIGHT,fill=Y)
    Entries.pack(fill=BOTH, expand=1)
    disp.pack(fill=BOTH, expand=1)

    update()
开发者ID:peruraj,项目名称:Intelligent_library,代码行数:26,代码来源:frontend.py

示例8: ReplayTutor2

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
class ReplayTutor2(Tutor):
    """
    ReplayTutor:  a tutor for testing/backup purposes, that re-sends messages to plugins.
    """
    def __init__(self, entity_id, api_key, logger, run_once=None, args=None):
        super().__init__(entity_id, api_key, self.main_callback, run_once=run_once)
        self.run_once = run_once
        self.logger = logger
        
        self.student_id_value = None
        self.session_id_value = None
        
        self.root = None
        self.status = None
        self.student_id = None
        self.session_id = None
        self.problem_name = None
        self.step_name = None
        self.transaction_id = None
        self.outcome = None
        self.skillbox = None
        self.button = None
        self.import_button = None
        self.kt_button = None
        self.attr_name = None
        self.attr_value = None
        self.attr_button = None
        self.skill_id = None
        self.kt_button = None
        self.response_box = None
        
        self.json_in = None
        
    def post_connect(self):
        self.send("tutorgen.add_student",{},self.new_student_callback)
    
    def setup_gui(self):
        #main window
        self.root = Tk()
        self.root.wm_title("Transaction Replay Tutor")
        self.root.minsize(400,400)
    
        #menu
        menubar = Menu(self.root)
        menubar.add_command(label="Import Datashop File", command=self.import_datashop_file)
        menubar.add_command(label="Quit", command=self.root.quit)
        self.root.config(menu=menubar)
        
        #listbox
        w = Label(self.root, text="Transaction")
        w.pack(fill=X)
        
        frame = Frame()
        scrollbar = Scrollbar(frame, orient=VERTICAL)
        
        self.treeview = Treeview(frame,yscrollcommand=scrollbar.set)
        self.treeview["columns"] = ("problem_name","step_text","transaction_text","skill_names","outcome")
        self.treeview.heading("problem_name",text="Problem Name")
        self.treeview.heading("step_text",text="Step Text")
        self.treeview.heading("transaction_text",text="Transaction Text")
        self.treeview.heading("skill_names",text="Skill Names")
        self.treeview.heading("outcome",text="Outcome")
        
        self.treeview.bind('<<TreeviewSelect>>', self.populate_form)
    
        scrollbar.config(command=self.treeview.yview)
        scrollbar.pack(side=RIGHT, fill=Y)
        
        self.treeview.pack(side=LEFT, fill=BOTH, expand=1)
        
        frame.pack(fill=BOTH)
        
        #spacer frame
        separator = Frame(height=2, bd=1, relief=SUNKEN)
        separator.pack(fill=X, padx=5, pady=5)
        
        #student id
        w = Label(self.root, text="Student ID")
        w.pack(fill=X)
        self.student_id = Entry(self.root,state=DISABLED)
        self.student_id.pack(fill=X)
        
        #ssession id
        w = Label(self.root, text="Session ID")
        w.pack(fill=X)
        self.session_id = Entry(self.root,state=DISABLED)
        self.session_id.pack(fill=X)
        
        bigframe = Frame()
        bigframe.pack(fill=X,padx =5, ipady=5)
        leftframe = Frame(bigframe)
        leftframe.pack(side=LEFT,fill=X,expand=1)
        rightframe= Frame(bigframe)
        rightframe.pack(side=RIGHT,fill=X,expand=1)
        
        #Entry fields
        ##problem name
        w = Label(leftframe, text="Problem Name")
        w.pack(fill=X)
        self.problem_name = Entry(leftframe)
#.........这里部分代码省略.........
开发者ID:rcarlson-cli,项目名称:hpit_services,代码行数:103,代码来源:replay2.py

示例9: calender

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
def calender(w):
    global year, mon
    date_bg = "white"
    date_fg = "black"
    date_fgb = "blue"
    date_bgt = "white"
    date_fgt = "red"
    day_bg = "orange"
    day_fg = "white"
    mon_bg = "violet"
    mon_fg = "white"
    Magic_Sequence = "2345012356013456123460124560"
    month = {
        "jan": 0,
        "feb": 8,
        "mar": 25,
        "apr": 5,
        "may": 1,
        "jun": 9,
        "jul": 5,
        "aug": 13,
        "sep": 21,
        "oct": 17,
        "nov": 25,
        "dec": 21,
    }
    months = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"]
    day = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"]
    # ~ current year and month
    now = ctime().split()
    year = int(now[4])
    mon = now[1].lower()
    date = int(now[2])

    def Cal_config(modify=False):
        global year, mon
        mon_limit = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
        now = ctime().split()
        cyear = int(now[4])
        cmon = now[1].lower()
        cdate = int(now[2])
        if modify == "go":
            year, mon = int(y.entry.get()), m.entry.get()
        elif modify:
            if months.index(mon) + modify > 11:
                year, mon = year + 1, "jan"
            elif months.index(mon) + modify < 0:
                year, mon = year - 1, "dec"
            else:
                mon = months[months.index(mon) + modify]
        monl.config(text="%s - %d" % (mon.title(), year))
        if not year % 4:
            mon_limit[1] = 29  # Leap year Check
        year_id = (year + 3) % 28
        Required_Sequence = Magic_Sequence[month[mon] :] + Magic_Sequence[: month[mon]]
        addition_factor = int(Required_Sequence[year_id])
        notes = CalLookUp(mon)
        d = 1
        for i in range(37):
            if i < addition_factor or d > mon_limit[months.index(mon)]:  # blank positions
                datebuttons[i].config(text="", bg=date_bg, activebackground=date_bg)
            else:  # positions with date
                bc, fc = date_bg, date_fg
                bracket = 0
                if year == cyear and mon == cmon and d == cdate:
                    bc, fc, bracket = date_bgt, date_fgt, 1
                if "%0.2d" % (d) in notes:
                    fc = date_fgb
                datebuttons[i].config(
                    text="%s%0.2d%s" % ("(" * bracket, d, ")" * bracket),
                    bg=bc,
                    fg=fc,
                    activebackground="yellow",
                    activeforeground="black",
                )
                d += 1
        for each_item in Entries.get_children():
            Entries.delete(each_item)
        ordered = []
        for memo in notes:
            ordered.append(memo)
        ordered.sort()
        for memo in ordered:
            for note in notes[memo]:
                Entries.insert("", "end", values=(memo, note[0], note[1]))
        print("Cal configured to", mon, year)
        # ~ main calender frame

    pane = tkinter.tix.PanedWindow(w, orientation="vertical")
    pane.pack(side=tkinter.tix.TOP, fill=BOTH)
    f1 = pane.add("top", size=190, expand="0", allowresize=0)
    f2 = pane.add("info", expand="0", allowresize=0)

    f1pane = tkinter.tix.PanedWindow(f1, orientation="horizontal")
    f1pane.pack(side=tkinter.tix.TOP, fill=BOTH)
    f1f1 = f1pane.add("calender", size=200, allowresize=0)
    f1f2 = f1pane.add("options", allowresize=0)

    # ~ month heading
    calhead = Frame(f1f1, bg=date_bg)
#.........这里部分代码省略.........
开发者ID:rajivm1991,项目名称:Power-Toy,代码行数:103,代码来源:CalenderSet.py

示例10: BioInfo

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
class BioInfo(Tk):
    def __init__(self):
        Tk.__init__(self)
        self.wm_title("BioInfo : comparaison des listes")
        self.resizable(width=FALSE, height=FALSE)
        self.SortDir = False

        # Lists Types
        self.typeList1 = None
        self.typeList2 = None

        # Frame content
        self.frameContent = Frame(self)
        self.frameContent.pack(side=TOP, fill=X)

        # ScrollBar
        scrollbar = Scrollbar(self.frameContent, orient=VERTICAL)
        scrollbar.pack(side=RIGHT, fill=Y)

        # Result Content
        self.dataCols = ('microArn_A', 'microArn_B', 'FoldC', 'p-Value', 'Note')
        self.tree = Treeview(self.frameContent, columns=self.dataCols, show = 'headings', yscrollcommand=scrollbar.set)

        # configure column headings
        for c in self.dataCols:
            self.tree.heading(c, text=c, command=lambda c=c: self.columnSort(c, self.SortDir))
            self.tree.column(c, width=10)

        self.tree.pack(side=LEFT, fill=X, expand="yes")

        scrollbar.config(command=self.tree.yview)

        # Frame Lists
        self.frameLists = Frame(self)
        self.frameLists.pack(side=LEFT)

        # Frame Forms
        self.frameForms = Frame(self)
        self.frameForms.pack(side=LEFT, padx=20)

        #Liste n°1 selection
        self.frameList1 = Frame(self.frameLists)
        self.frameList1.pack()

        self.typeListStr1 = StringVar(self.frameList1)
        self.typeListStr1.set(str(ListBioType.TypeA))

        self.buttonTypeList1 = OptionMenu(self.frameList1, self.typeListStr1, str(ListBioType.TypeA), str(ListBioType.TypeB)).pack(side=LEFT)

        self.entrylist1 = Entry(self.frameList1, width=30)
        self.entrylist1.pack(side=LEFT)

        self.buttonBrowseList1 = Button(self.frameList1, text="Parcourir", command=self.load_fileList1, width=10)
        self.buttonBrowseList1.pack(side=LEFT, padx=5)

        # List n°2 selection
        self.frameList2 = Frame(self.frameLists)
        self.frameList2.pack(side=BOTTOM)

        self.typeListStr2 = StringVar(self.frameList2)
        self.typeListStr2.set(str(ListBioType.TypeB))

        self.buttonTypeList2 = OptionMenu(self.frameList2, self.typeListStr2, str(ListBioType.TypeA), str(ListBioType.TypeB)).pack(side=LEFT)

        self.entrylist2 = Entry(self.frameList2, width=30)
        self.entrylist2.pack(side=LEFT)

        self.buttonBrowseList2 = Button(self.frameList2, text="Parcourir", command=self.load_fileList2, width=10)
        self.buttonBrowseList2.pack(side=LEFT, padx=5)

        # Form pValue
        self.framePVal = Frame(self.frameForms)
        self.framePVal.pack()

        Label(self.framePVal, text="pValue").pack(side=LEFT)
        self.entryPVal = Entry(self.framePVal, width=6)
        self.entryPVal.pack(side=LEFT)

        # Form foldC
        self.frameFoldC = Frame(self.frameForms)
        self.frameFoldC.pack()

        Label(self.frameFoldC, text="foldCh").pack(side=LEFT)
        self.entryFoldC = Entry(self.frameFoldC, width=6)
        self.entryFoldC.pack(side=LEFT)

        # Form note
        self.frameNote = Frame(self.frameForms)
        self.frameNote.pack()

        Label(self.frameNote, text="note    ").pack(side=LEFT)
        self.entryNote = Entry(self.frameNote, width=6)
        self.entryNote.pack(side=LEFT)

        # Bouton comparer
        self.buttonComparer = Button(self, text="Comparer", command=self.compare, width=10, state=DISABLED)
        self.buttonComparer.pack(fill= X, expand="yes", padx=20, pady=(10,0))

        #Bouton exporter
        self.buttonExport = Button(self, text="Exporter", command=self.export, width=10, state=DISABLED)
#.........这里部分代码省略.........
开发者ID:S0obi,项目名称:BioInfo,代码行数:103,代码来源:BioInfo.py

示例11: Expenses

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]

#.........这里部分代码省略.........
        self.inventoryDB.insertInvetory(self.item)
        return self.successful()

    # Displays a success message when the item is added
    def successful(self):
        self.master.title("%s was added successfully!" % self.item.name)

        succMessage = Message(root, text = "%s was successfully added to the %s list!" % (self.item.name, self.item.itemType))
        succMessage.place(x = 150, y = 150)

        startOverButton = Button(root, text = "Start Over", command=lambda: self.sequence(self.createOptionButtons))#self.saveNameAndType(itemName)))#(self.saveNameAndType(itemName)))  # (itemName)))# lambda: self.sequence(self.test))  #This button will send the user to the add inventory page
        startOverButton.place(x = 150, y = 350)

    # Used to view the inventory
    def viewInveroty(self):
        # Creates the label called chooseTypeLabel and a drop down menu called chooseItemType
        chooseTypeLabel = Label(root, text = "Item's type: ")
        chooseTypeLabel.place(x = 110, y = 160)
        self.chooseItemType = StringVar(root)       # The drop down menu is created and assigned to chooseItemType
        self.chooseItemType.set("Tree")             # Tree is set to the default option in the drop down menu
        typeChoices = OptionMenu(root, self.chooseItemType, "Tree", "Animal", "Machine", "All")    # Options Tree, Animal, Machine, and ALL are added to the drop down menu
        typeChoices.place(x = 190, y = 160)

        backButton = Button(root, text = "Back", command=lambda: self.sequence(self.createOptionButtons))  # This button will return the user to the expenses option page
        backButton.place(x = 50, y = 350)

        nextButton = Button(root, text = "Next", command=lambda: self.sequence(self.displayGeneralInventory))#self.saveNameAndType(itemName)))#(self.saveNameAndType(itemName)))  # (itemName)))# lambda: self.sequence(self.test))  #This button will send the user to the add inventory page
        nextButton.place(x = 350, y = 350)

    # Used to create the inventory table
    def displayGeneralInventory(self):
        # This creates a table using the function Treeview
        self.tree = Treeview(height="20", columns=("Name", "Current Quantity"))
        self.tree.pack()
        self.tree.heading('#1', text = "Name", anchor = CENTER)
        self.tree.heading('#2', text = "Current Quantity", anchor = CENTER)
        self.tree.column('#1', minwidth=0, width = 100)
        self.tree.column('#2', minwidth=0, width = 100)
        self.tree.column('#0', minwidth=0, width = 0)

        itemType = self.chooseItemType.get()

        if(itemType == "All"):
            self.obtainData("Tree")
            self.obtainData("Animal")
            self.obtainData("Machine")

        else:
            self.obtainData(itemType)

    # Adds database data to the inventory table
    def obtainData(self, type):
        for row in (self.inventoryDB.getOverviewInventory(type)):
            name = row[0]
            totalQuantity = row[1]

            # Inserts data into the table. Each entry is tagged with the name and the type
            # This is done in order to make identifying the entries easier for when detailed
            # tables are requested
            self.tree.insert("", "end", values = (name,totalQuantity), tag= [name, type])

        # Creates a bak function that is used in the displayGeneralInventory functions
        self.backFunction = self.displayGeneralInventory

        # Binds a double click function to the Treeview table. If an entry is double clicked,
        # the function displayGeneralInventory is ran
开发者ID:willgoishi,项目名称:CSCI_150_AG_Project,代码行数:70,代码来源:GUI_CLASS.py

示例12: hyGUI

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
class hyGUI(Frame):


    def __init__(self):


        Frame.__init__(self)
        self.master.title("Hockey team Data")

        self.master.maxsize(1400, 1000)      ##  Maximum Frame size
        self.pack()
        self._treeview = Treeview(self)      ## initialize the treeview


##  Writing label on gui and creating a data insert box to get user input when clicking a button

        self.gameLocationLabel = Label(self, text = "Enter game location")
        self.gameLocationLabel.pack()

        self.gameLocationVar = StringVar()
        self.gameLocationEntry = Entry(self, textvariable = self.gameLocationVar, width=30)
        self.gameLocationEntry.pack()



        self.gameDateLabel = Label(self, text = "Enter game date")
        self.gameDateLabel.pack()

        self.gameDateVar = StringVar()
        self.gameDateEntry = Entry(self, textvariable = self.gameDateVar, width = 30)
        self.gameDateEntry.pack()



        self.hatSoldLabel = Label(self, text = "Enter how many hats were sold")
        self.hatSoldLabel.pack()

        self.hatSoldVar = StringVar()
        self.hatSoldEntry = Entry(self, textvariable = self.hatSoldVar, width = 30)
        self.hatSoldEntry.pack()



        self.posterSoldLabel = Label(self, text = "Enter how many poster were sold")
        self.posterSoldLabel.pack()

        self.posterSoldVar = StringVar()
        self.posterSoldEntry = Entry(self, textvariable = self.posterSoldVar, width = 30)
        self.posterSoldEntry.pack()


        self.jerseySoldLabel = Label(self, text = "Enter how many jersey were sold")
        self.jerseySoldLabel.pack()

        self.jerseySoldVar = StringVar()
        self.jerseySoldEntry = Entry(self, textvariable = self.jerseySoldVar, width = 30)
        self.jerseySoldEntry.pack()


        self.hockeyStickSoldLabel = Label(self, text = "Enter how many hockey stick were sold")
        self.hockeyStickSoldLabel.pack()

        self.hockeyStickSoldVar = StringVar()
        self.hockeyStickSoldEntry = Entry(self, textvariable = self.hockeyStickSoldVar, width = 30)
        self.hockeyStickSoldEntry.pack()



##  Creating space between the button on the GUI interface
        self._resultVar = StringVar()
        self._resultLabel = Label(self, text=" \n ", textvariable=self._resultVar)
        self._resultLabel.pack()


##  Add button
        self._addButton = Button(self, text="Add", command=self._add)
        self._addButton.pack()


        self._resultVar = StringVar()
        self._resultLabel = Label(self, text=" \n ", textvariable=self._resultVar)
        self._resultLabel.pack()


## Delete button
        self._addButton = Button(self, text="Delete", command=self._delete)
        self._addButton.pack()

        self._resultVar = StringVar()
        self._resultLabel = Label(self, text=" \n ", textvariable=self._resultVar)
        self._resultLabel.pack()


## Exit button
        self._exitButton = Button(self, text="Exit", command=self._exit)
        self._exitButton.pack()

        self._resultVar = StringVar()
        self._resultLabel = Label(self, text=" \n ", textvariable=self._resultVar)
        self._resultLabel.pack()
#.........这里部分代码省略.........
开发者ID:airskyler,项目名称:HockeyGUI,代码行数:103,代码来源:HockeyGUI.py

示例13: IncomeGUI

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
class IncomeGUI(Frame):   
    inDB = incomeDB()

    def createIncome(self):
        addIncome = Button(self, text="Add income", command=lambda: self.sequence(self.addMonth))
        addIncome.pack(fill=X, padx=10, pady=20)

        incomeButton = Button(self, text="View income", command =lambda: self.sequence(self.viewIncome))
        incomeButton.pack(fill=X, padx=10, pady=5)

        backButton = Button(self, text="Back")
        backButton.pack(side=BOTTOM)

    def addMonth(self):
        monthlabel = Label(self, text = "Select Month: ")
        monthlabel.pack()
        self.monthChoice = IntVar(self)
        months = self.numberings(1, 12)
        self.monthChoice.set(1) 
        self.monthInput = OptionMenu(self, self.monthChoice, *months)
        self.monthInput.pack()
        yearlabel = Label(self, text = "Select Year: ")
        yearlabel.pack()
        self.yearChoice = IntVar(self)
        years = self.numberings(2000, 2020)
        self.yearChoice.set(2000) 
        self.yearInput = OptionMenu(self, self.yearChoice, *years)
        self.yearInput.pack()
        

        nextButton = Button(self, text="Next", command=lambda: self.sequence(self.addIncome))
        nextButton.pack()
        backButton = Button(self, text="Back", command=lambda: self.sequence(
            self.createIncome))
        backButton.pack()

    def addIncome(self):
        month = self.monthChoice.get()
        self.income = income(month)
        self.income.year = self.yearChoice.get()

        amountlabel = Label(self, text="Amount of items sold this month: ")
        amountlabel.pack()
        self.amountinput = Entry(self)
        self.amountinput.pack()

        incomelabel = Label(self, text="Income earned: ")
        incomelabel.pack()
        self.incomeinput = Entry(self)
        self.incomeinput.pack()

        nextButton = Button(self, text="Next",
                            command= self.saveDetails)
        nextButton.pack()
        backButton = Button(self, text="Back", command=lambda: self.sequence(
            self.createIncome))
        backButton.pack()

    def saveDetails(self):
        self.income.amount = self.amountinput.get()
        self.income.income = self.incomeinput.get()
        self.sequence(self.confirmation)

    def confirmation(self):

        year = Label(self, text="Year: ")
        year.pack()
        yearin = Label(self, text=self.income.year)
        yearin.pack()

        month = Label(self, text="Month: ")
        month.pack()
        monthin = Label(self, text=self.income.month)
        monthin.pack()

        quantity = Label(self, text="Amount of items sold this month: ")
        quantity.pack()
        itemQuantity = Label(self, text=self.income.amount)
        itemQuantity.pack()

        price = Label(self, text="Income earned: ")
        price.pack()
        itemPrice = Label(self, text=self.income.income)
        itemPrice.pack()        

        nextButton = Button(self, text="Next",
                            command=lambda: self.sequence(self.addToIncomeDatabase))
        nextButton.pack()
        backButton = Button(self, text="Back", command=lambda: self.sequence(
            self.createIncome))
        backButton.pack()

    def addToIncomeDatabase(self):
        self.incomeDB.insertIntoDB(self.income)

        addedMessage = Message(self, text = "Added to database!")
        addedMessage.pack()

        endSessionButton = Button(self, text = "End Session", command=lambda: self.sequence(self.createIncome))
        endSessionButton.pack()
#.........这里部分代码省略.........
开发者ID:willgoishi,项目名称:CSCI_150_AG_Project,代码行数:103,代码来源:IncomeGUI.py

示例14: digiclock

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
def digiclock(w):
	pane = tkinter.tix.PanedWindow(w, orientation='vertical')
	pane.pack(side=tkinter.tix.TOP, expand=1, fill=BOTH)
	f1 = pane.add('time',size=190)
	f2 = pane.add('options')
	
	f2pane = tkinter.tix.PanedWindow(f2, orientation='horizontal')
	f2pane.pack(side=tkinter.tix.TOP, expand=1, fill=BOTH)
	f2f1 = f2pane.add('alarm',size=150)
	f2f2 = f2pane.add('event')
	
	global al_status,al_time,m
	m='am'
	ts_status=ON
	al_status=OFF
	al_time=str()
	colour=['orange','red','violet','pink','blue','grey']
	def ConfigEvents():
		now=ctime().split()
		year=int(now[4])
		mon=now[1].lower()
		date=int(now[2])
		notes=CalLookUp( mon )
		for each_item in Entries.get_children():
			Entries.delete(each_item)
		ordered=[]
		for memo in notes: 
			if(int(memo) >= date):
				ordered.append(memo)
		ordered.sort()
		for memo in ordered:
			for note in notes[memo]:
				Entries.insert('', 'end', values=( memo, note[0], note[1]) )
	def displayTime(st,ts):
		global al_time,m
		sleep(3)
		day={'Mon'	:	'Monday'	,
			'Tue'  	:	'Tuesday'	,
			'Wed'	:	'Wednesday',
			'Thu'	:	'Thursday',
			'Fri'	:	'Friday'	,
			'Sat'	:	'Saturday',
			'Sun'	:	'Sunday'	}
		while(st):
			ct=ctime().split(' ')
			m='AM'
			if int(ct[3].split(':')[0])>11 : 
				m='PM'
				if int(ct[3].split(':')[0])>12 :	
					ct[3]=str( int( ct[3][:2] )-12 ) + ct[3][2:]
			if (ct[3].split(':')[0] == '00' ):	
				ct[3]='12' + ct[3][2:]
				ConfigEvents()
			#~ if (not int(ct[3].split(':')[2])%10):	ts.config( bg=colour[ int( int( ct[3].split(':')[2] )/10) ] )
			mhs=ct[3].split(':')
			mode=	{
					'time&date'	:'%s-%s-%s\n%s\n%0.2d:%0.2d:%0.2d %s'%(ct[1],ct[2],ct[4],day[ct[0]],int(mhs[0]),int(mhs[1]),int(mhs[2]),m),
					'time'		:'%0.2d:%0.2d:%0.2d %s'%(int(mhs[0]),int(mhs[1]),int(mhs[2]),m)
					}
			text	=mode['time&date']
			#~ print(ct)
			ts.config(text=text)
			#~ print(al_time,mode['time'],al_time==mode['time'])
			if(al_time==mode['time']):
				set.config( text='Stop' )
				cal.config( text='Expired @ ' + al_time[:-2] )
				thread.start_new_thread(lambda snd='ringout', repeat=ON :play( snd, repeat ) ,() )
			sleep(1)
	def sett():
		global al_status,sound_continueous,al_time
		if(al_status):
			al_status = OFF
			sound_continueous = OFF
			al_time = ''
			cal.config( text='No Alarm' )
			set.config( text='Set' )
		else:
			al_status = ON
			al_time = at.entry.get()+' '+ampm.entry.get()
			cal.config( text='Set @ ' + al_time )
			set.config( text='Remove' )
	bg='orange'
	#~ time frame
	tf=Frame( f1, bg='black' )
	ts=Label(		tf
				,text="rajiv.m1991\[email protected]\ngmail.com"
				,font='times 40'
				,bg='violet'
				,width=11
				,fg='white')
	tf.pack(fill=BOTH)
	ts.pack(fill=X)
	#~ alarm frame
	af=Frame(f2f1,bg=bg)
	al=Label(	af
			,text="$ Alarm $"
			,font='times'
			,fg='white'
			,bg='black')
	at=LabelEntry( af, label='HH:MM:SS', bg=bg )
#.........这里部分代码省略.........
开发者ID:rajivm1991,项目名称:Power-Toy,代码行数:103,代码来源:DigiClock.py

示例15: fillTree

# 需要导入模块: from tkinter.ttk import Treeview [as 别名]
# 或者: from tkinter.ttk.Treeview import pack [as 别名]
class Window:
    def fillTree(self,path, parent, list):
        for file in os.listdir(path):
            abspath = os.path.join(path,file)
            color = ""
            treelist = None
            for mini in list:
                if abspath in mini:
                    color = 'red'
                    treelist = mini
                else:
                    for lk in mini:
                        if abspath in lk:
                            color = 'purple'
            child = None
            if color == 'red':
                child = self.tree.insert(parent,'end',text=file,open=False,tags=(abspath,'red',str(treelist)),)
            elif color == 'purple':
                child = self.tree.insert(parent,'end',text=file,open=False,tags=(abspath,'purple'))
            else:
                child = self.tree.insert(parent,'end',text=file,open=False,tags=(abspath,'white'))
            if(os.path.isdir(abspath)):
                self.tree.insert(child,'end',text='',open=False)
    def __init__(self,list,dirlist):
        self.root = Tk()
        self.root.wm_title("Duplicate_Files")
        self.min = None
        self.list = list
        self.root.geometry('600x600+0+0')
        self.tree = Treeview(self.root ,height=15)
        self.tree.pack(expand='yes',fill='both')
        self.tree.heading('#0',text="files")
        self.tree.tag_configure('red',foreground='red')
        self.tree.tag_configure('purple',foreground='#cc00ff')
        self.tree.bind("<Double-1>",self.onDoubleClick)
        self.tree.bind("<<TreeviewOpen>>",self.onOpen)
        self.tree.bind("<<TreeviewClose>>",self.onClose)
        for path in dirlist:
            branch = self.tree.insert('','end',text=path,open=True,tags=(path,'white'))
            self.fillTree(path,branch,list)
        self.root.mainloop()


    def onDoubleClick(self,event):
        item = self.tree.selection()[0]
        print ("clicked" + str(self.tree.item(item,'tags')[0]))
        if str(self.tree.item(item,'tags')[1]) == "red":
            list_of_files = ast.literal_eval(str(self.tree.item(item,'tags')[2]))
            if self.min != None:
                if self.min.mini.winfo_exists():
                    self.min.mini.destroy()
            self.min = MiniWindow(self.root,list_of_files)

    def onOpen(self,event):
        item = self.tree.selection()[0]
        if self.tree.parent(item) != '':
            if len(self.tree.get_children(item))>0:
                self.tree.delete(self.tree.get_children(item))
            abspath = str(self.tree.item(item,'tags')[0])
            if(os.path.isdir(abspath)):
                self.fillTree(abspath, item,self.list)
    def onClose(self,event):
        item = self.tree.selection()[0]
        if self.tree.parent(item) != '':
            if len(self.tree.get_children(item))>0:
                self.tree.delete(self.tree.get_children(item))
开发者ID:bretttjohnson1,项目名称:Duplicate_Discoverer,代码行数:68,代码来源:window.py


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