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


Python tkinter.Frame类代码示例

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


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

示例1: show_source_tree

def show_source_tree(head):
    root = Tk()
    frame = Frame(root)
    frame.pack(fill = 'both')
    tree = tkinter.ttk.Treeview(frame)
    
    #insert root subroutine
    # @type head Node
    parent_id = tree.insert('', 'end', '', text = head.name)
    for child in head.children:
        child.insert_to_tree(tree, parent_id)



    
    #add scrollbar
    v_scrollbar = Scrollbar(frame, orient = VERTICAL, command = tree.yview)
    h_scrollbar = Scrollbar(frame, orient = HORIZONTAL, command = tree.xview)
    tree.configure(yscrollcommand = v_scrollbar.set, xscrollcommand = h_scrollbar.set)
    
    v_scrollbar.pack(side = 'right', fill = 'y')
    h_scrollbar.pack(side = 'bottom', fill = 'x')


    tree.pack(fill = 'both')
    root.geometry("600x600")
    root.mainloop()
开发者ID:guziy,项目名称:CallTreeGenerator,代码行数:27,代码来源:test_tkinter.py

示例2: __init__

	def __init__(self, parent, n):
		Frame.__init__(self, parent)
		self.parent = parent;
		self.parent.maxsize(1200,720)
		self.parent.minsize(1200,720)
		self.initUI()
		self.placeWindow(n)
开发者ID:urrfinjuss,项目名称:gas-network,代码行数:7,代码来源:gas.py

示例3: __init__

 def __init__(self, parent, *args, **kw):
     Frame.__init__(self, parent, *args,**kw)
     self.e=Entry(self, text='Message')
     self.e.delete(0,'end')
     self.e.pack()
     self.makebuttons()        
     self.pack(expand='true',fill='x')
开发者ID:jbpeters,项目名称:Time-keeper,代码行数:7,代码来源:tkmin.py

示例4: ua_win_tk

def ua_win_tk(url, pipe = None):
    from tkinter import Tk, Frame, Label, Entry, StringVar, BOTH, Button, RIGHT
    import sys
    sys.stdout.flush()
    instructions = "Visit the following URL to authorize the application:"
    response = {"x": False}
    root = Tk()
    root.title("oAuth2 Authorization Required")
    webbox = Frame(root)
    instructions = Label(webbox, text = instructions)
    instructions.pack(padx = 5, pady = 5)
    urlstr = StringVar(value = url)
    urlbox = Entry(webbox, textvariable = urlstr, state = "readonly")
    urlbox.pack(padx = 5, pady = 5)
    def open_browser():
        from subprocess import Popen
        p = Popen(["sensible-browser", url])
    browserbutton = Button(webbox, text = "Open in web browser", command = open_browser)
    browserbutton.pack(padx = 5, pady = 5)
    webbox.pack(fill = BOTH, expand = 1)
    if pipe:
        def poll():
            if pipe.poll():
                root.destroy()
                #Mutability ftw... wat
                response["x"] = True
            else:
                root.after(300, poll)
        root.after(300, poll)
    cancelbutton = Button(root, text = "Cancel", command = root.destroy)
    cancelbutton.pack(side = RIGHT, padx = 5, pady = 5)
    root.mainloop()
    return response["x"]
开发者ID:pyokagan,项目名称:pyoauth2client,代码行数:33,代码来源:ui.py

示例5: __init__

    def __init__(self, parent):
        Frame.__init__(self, parent, background="white")

        self.parent = parent

        self.parent.title("Test title")
        self.fullscreen()
开发者ID:tiborv,项目名称:tdt4140-swag,代码行数:7,代码来源:tkintertest.py

示例6: _initfilepanel

 def _initfilepanel(self):
     frame = Frame(self)
     frame.grid(row=0, column=0, sticky=E + W + S + N)
     
     label = Label(frame, text="File List: ")
     label.grid(sticky=N + W)
     
     self.filelist = Listbox(frame, width=40)
     self.filelist.grid(row=1, column=0, rowspan=2, columnspan=3)
     
     vsl = Scrollbar(frame, orient=VERTICAL)
     vsl.grid(row=1, column=3, rowspan=2, sticky=N + S + W)
     
     hsl = Scrollbar(frame, orient=HORIZONTAL)
     hsl.grid(row=3, column=0, columnspan=3, sticky=W + E + N)
     
     self.filelist.config(yscrollcommand=vsl.set, xscrollcommand=hsl.set)
     self.filelist.bind('<<ListboxSelect>>', self._onfilelistselection)
     
     hsl.config(command=self.filelist.xview)
     vsl.config(command=self.filelist.yview)
     
     upbtn = Button(frame, text="Up", width=7, command=self._upfile)
     upbtn.grid(row=1, column=4, padx=5, pady=5)
     
     downbtn = Button(frame, text="Down", width=7, command=self._downfile)
     downbtn.grid(row=2, column=4, padx=5, pady=5)
     
     newbtn = Button(frame, text="New", width=7, command=self._addfile)
     newbtn.grid(row=4, column=1, pady=5, sticky=E + S)
     
     delbtn = Button(frame, text="Delete", width=7, command=self._deletefile)
     delbtn.grid(row=4, column=2, padx=5, pady=5, sticky=W + S)
开发者ID:shawncx,项目名称:LogParser,代码行数:33,代码来源:logui.py

示例7: __init__

    def __init__(self):
        Toplevel.__init__(self)
        self.focus_set()
        self.grab_set()

        self.result = None
        self.module_data = None
        self.mod_applis = None
        self.title(ugettext("Instance editor"))
        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(0, weight=1)

        self.ntbk = ttk.Notebook(self)
        self.ntbk.grid(row=0, column=0, columnspan=1, sticky=(N, S, E, W))

        self.frm_general = Frame(self.ntbk, width=350, height=150)
        self.frm_general.grid_columnconfigure(0, weight=0)
        self.frm_general.grid_columnconfigure(1, weight=1)
        self._general_tabs()
        self.ntbk.add(self.frm_general, text=ugettext('General'))

        self.frm_database = Frame(self.ntbk, width=350, height=150)
        self.frm_database.grid_columnconfigure(0, weight=0)
        self.frm_database.grid_columnconfigure(1, weight=1)
        self._database_tabs()
        self.ntbk.add(self.frm_database, text=ugettext('Database'))

        btnframe = Frame(self, bd=1)
        btnframe.grid(row=1, column=0, columnspan=1)
        Button(btnframe, text=ugettext("OK"), width=10, command=self.apply).grid(
            row=0, column=0, sticky=(N, S, E))
        Button(btnframe, text=ugettext("Cancel"), width=10, command=self.destroy).grid(
            row=0, column=1, sticky=(N, S, W))
开发者ID:povtux,项目名称:core,代码行数:33,代码来源:lucterios_gui.py

示例8: startGui

def startGui():
    try:
        import_tk()
    except:
        logging.error("Error Starting GUI. Could Not Find Tkinter module" + "Please install the Python Tkinter module")
        return

    root = Tk()
    root.wm_title("Eagle V6 to KiCad Converter")
    root.wm_minsize(400, 200)
    frame = Frame(root, relief=RIDGE, bg="BLUE", borderwidth=2)
    frame.pack(fill=BOTH, expand=1)

    label = Label(frame, font=20, bg="BLUE", text="What Would You Like to Do:")
    label.pack(fill=X, expand=1)

    butBrd = Button(frame, text="Convert Board", command=convertBoardGUI)
    butBrd.pack(fill=X, expand=1)
    butLib = Button(frame, text="Convert Library", command=convertLibGUI)
    butLib.pack(fill=X, expand=1)
    butSch = Button(frame, text="Convert Schematic", command=convertSchGUI)
    butSch.pack(fill=X, expand=1)

    label = Label(frame, bg="BLUE", text="www.github.com/Trump211")
    label.pack(fill=X, expand=1)

    root.mainloop()
开发者ID:DanChianucci,项目名称:Eagle2Kicad,代码行数:27,代码来源:Start.py

示例9: __init__

    def __init__(self, parent, title=None):
        Toplevel.__init__(self, parent)
        self.transient(parent)

        if title:
            self.title(title)

        self.parent = parent
        self.result = None

        body = Frame(self)
        self.initial_focus = self.body(body)
        body.pack(padx=5, pady=5)
        self.buttonbox()
        self.grab_set()

        if not self.initial_focus:
            self.initial_focus = self

        self.protocol("WM_DELETE_WINDOW", self.cancel)
        self.geometry("+%d+%d" % (parent.winfo_rootx() + 50,
                                  parent.winfo_rooty() + 50))
        self.initial_focus.focus_set()

        self.wait_window(self)
开发者ID:SpeedProg,项目名称:PveLauncher,代码行数:25,代码来源:tksimpledialog.py

示例10: __init__

 def __init__(self, bg='black', parent=None):
     Frame.__init__(self, bg='black', parent=None)
     #self.title("CTA Train Tracker ")
     self.driv = driver.Driver()
     self.pack()
     self.memory=''
     traintracker.make_widgets(self)
开发者ID:dahlke,项目名称:PyTrain,代码行数:7,代码来源:traintracker.py

示例11: __init__

    def __init__(self):
        '''
        Constructor

        Initialise GameOfLife object
        Build the gui, bind events and initialise the display
        '''
        # Encasing frame
        tk = Tk()
        Frame.__init__(self, master=tk)

        # Grid frame
        self._grid = GridWidget(self, X_SIZE, Y_SIZE)
        for row in self._grid.get_cells():
            for cell in row:
                cell.bind('<Button-1>', self._cell_listener)

        # buttons
        self._next_button = NextButton(master=self)
        self._next_button.bind('<Button-1>', self._next_step_button_listener)

        # Set layout
        self._grid.grid(row=0, column=0)
        self._next_button.grid(row=0, column=1)

        # Game of life
        self._gol = GameOfLife(RuleSetStandard(), self._grid)

        self.pack()
        self._grid.pack()
        self._next_button.pack()
开发者ID:leahcimNosliw,项目名称:Game_of_life,代码行数:31,代码来源:gui.py

示例12: initInterfaceZone

    def initInterfaceZone(self):
        # Draw the play, step and loading buttons
        self.interfaceFrame = Frame(self, background="dark gray")
        self.playFrame = Frame(self.interfaceFrame, background="dark gray")
        self.loadFrame = Frame(self.interfaceFrame, background="dark gray")

        self.isPlaying = False

        #Do the run buttons
        playButton = Button(self.playFrame, text=">", command=self.playPress)
        playButton.grid(row=0,column=0)
        pauseButton = Button(self.playFrame, text="||", command=self.pausePress)
        pauseButton.grid(row=0,column=1)
        stepBackButton = Button(self.playFrame, text="|<", command=self.stepBackPress)
        stepBackButton.grid(row=1,column=0)
        stepForwardButton = Button(self.playFrame, text=">|", command=self.stepForwardPress)
        stepForwardButton.grid(row=1,column=1)

        self.playFrame.pack(side=LEFT, expand=1, fill=BOTH)

        #Do the load-y stuff
        self.boardInputField = Entry(self.loadFrame)
        self.boardInputField.grid(row=0, column=0)
        boardInputButton = Button(self.loadFrame, text="Load Board", command=self.loadBoardPress)
        boardInputButton.grid(row=0, column=1)
        self.moveInputField = Entry(self.loadFrame)
        self.moveInputField.grid(row=1,column=0)
        moveInputButton = Button(self.loadFrame, text="Load Moves", command=self.loadMovesPress)
        moveInputButton.grid(row=1, column=1)

        self.loadFrame.pack(side=LEFT, expand=1, fill=BOTH)

        self.interfaceFrame.pack(side=BOTTOM)
开发者ID:j-salazar,项目名称:block-solver,代码行数:33,代码来源:blockgame.py

示例13: __init__

    def __init__(self, parent):
       
        # super(createSets,self).__init__(parent)
        Frame.__init__(self, parent)
        self.parent = parent
        self.grid(row=0, column=0)

        self.parentWindow = 0

        self.listBox = Listbox(self, selectmode=EXTENDED)
        self.listBox.grid(row=1, column=1)
        for item in ["one", "two", "three", "four"]:
            self.listBox.insert(END, item)
        
        self.buttonDel = Button(self,
                                text="delite selected class",
                                command=self.del_selected)  # lambda ld=self.listBox:ld.delete(ANCHOR))
        self.buttonDel.grid(row=0, column=0)
            
        self.entry = Entry(self, state=NORMAL)
        # self.entry.focus_set()
        self.entry.insert(0, "default")
        self.entry.grid(row=1, column=0)
        
        self.buttonInsert = Button(self, text="add new class",
                                   command=self.add)
        self.buttonInsert.grid(row=0, column=1)
        
        self.buttonDone = Button(self, text="done", command=self.done)
        self.buttonDone.grid(row=2, column=0)
开发者ID:valdecar,项目名称:faceRepresentWithHoG,代码行数:30,代码来源:gui.py

示例14: ProgramWidget

class ProgramWidget(Frame):

    def __init__(self, parent, client):
        super(ProgramWidget, self).__init__(parent)
        self.client = client
        self.client.onProgramChange = self.programChanged

        self.programLabel = Label(self, text = 'Program:')
        self.programLabel.grid(row = 0, column = 0)
        self.programEntry = Entry(self, text = 'Program name',
                                  state = 'readonly')
        self.programEntry.grid(row = 0, column = 1)
        self.buttonPanel = Frame(self)
        self.buttonPanel.grid(row = 1, column = 0, columnspan = 2, sticky = W)
        self.newButton = Button(self.buttonPanel, text='New',
                                command = self.newProgram)
        self.newButton.pack(side = LEFT)

    def programChanged(self):
        self.__setProgramText(str(self.client.state))

    def __setProgramText(self, text):
        self.programEntry.configure(state = NORMAL)
        self.programEntry.delete(0)
        self.programEntry.insert(0, text)
        self.programEntry.configure(state = 'readonly')

    def newProgram(self):
        self.client.makeNewProgram()
开发者ID:mindhog,项目名称:mawb,代码行数:29,代码来源:tkui.py

示例15: __init__

 def __init__(self, parent):
     Frame.__init__(self, parent, background="white")   
      
     self.parent = parent
     self.parent.title("Centered window")
     self.pack(fill=BOTH, expand=1)
     self.centerWindow()
开发者ID:gddickinson,项目名称:python_code,代码行数:7,代码来源:centeredWindow.py


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