• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tkinter.Frame类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: __init__

    def __init__(self, root):
        
        # create labels and frames with initial values and bind them
        self.root = root
        self.main = Frame(root)
        
        self.header = Frame(root)
        self.header_label = Label(self.header, text='2048 Game')
        self.score_label = Label(self.header)
        self.turn_label = Label(self.header, wraplength=150, height=3)        
        self.reset = Button(self.header, text="Restart", command = self.new_board)
        self.reset.pack()
        self.header.pack()
        self.header_label.pack()
        self.score_label.pack()
        self.turn_label.pack()
        self.main.pack()
        self.root.bind('<Left>', self.game_play)
        self.root.bind('<Right>', self.game_play)
        self.root.bind('<Up>', self.game_play)
        self.root.bind('<Down>', self.game_play)
        
        self.new_board()

        # start tkinter gui
        self.root.mainloop()
开发者ID:crashrose,项目名称:Py2048,代码行数:26,代码来源:Py2048.py


示例17: _initjoincondpanel

 def _initjoincondpanel(self):
     frame = Frame(self)
     frame.grid(row=0, column=2, sticky=E + W + S + N, padx=5)
     
     label = Label(frame, text="Join Condition: ")
     label.grid(sticky=N + W)
     
     self.joincondlist = Listbox(frame)
     self.joincondlist.grid(row=1, rowspan=1, columnspan=3, sticky=E + W + S + N)
     
     vsl = Scrollbar(frame, orient=VERTICAL)
     vsl.grid(row=1, column=3, rowspan=1, sticky=N + S + W)
     
     hsl = Scrollbar(frame, orient=HORIZONTAL)
     hsl.grid(row=2, column=0, columnspan=3, sticky=W + E + N)
     
     self.joincondlist.config(yscrollcommand=vsl.set, xscrollcommand=hsl.set)
     
     hsl.config(command=self.joincondlist.xview)
     vsl.config(command=self.joincondlist.yview)
     
     newbtn = Button(frame, text="New", width=7, command=self._addjoincondition)
     newbtn.grid(row=3, column=0, padx=5, pady=5, sticky=E)
     
     delbtn = Button(frame, text="Delete", width=7, command=self._deletejoincondition)
     delbtn.grid(row=3, column=1, sticky=E)
     
     modbtn = Button(frame, text="Update", width=7, command=self._modifyjoincondition)
     modbtn.grid(row=3, column=2, padx=5, pady=5, sticky=W)
开发者ID:shawncx,项目名称:LogParser,代码行数:29,代码来源:logui.py


示例18: Wall

class Wall(object):
    MIN_RED = MIN_GREEN = MIN_BLUE = 0x0
    MAX_RED = MAX_GREEN = MAX_BLUE = 0xFF

    PIXEL_WIDTH = 50

    def __init__(self, width, height):
        self.width = width
        self.height = height
        self._tk_init()
        self.pixels = [(0, 0, 0) for i in range(self.width * self.height)]

    def _tk_init(self):
        self.root = Tk()
        self.root.title("ColorWall %d x %d" % (self.width, self.height))
        self.root.resizable(0, 0)
        self.frame = Frame(self.root, bd=5, relief=SUNKEN)
        self.frame.pack()

        self.canvas = Canvas(self.frame,
                             width=self.PIXEL_WIDTH * self.width,
                             height=self.PIXEL_WIDTH * self.height,
                             bd=0, highlightthickness=0)
        self.canvas.pack()
        self.root.update()

    def set_pixel(self, x, y, hsv):
        self.pixels[self.width * y + x] = hsv

    def get_pixel(self, x, y):
        return self.pixels[self.width * y + x]

    def draw(self):
        self.canvas.delete(ALL)
        for x in range(len(self.pixels)):
            x_0 = (x % self.width) * self.PIXEL_WIDTH
            y_0 = (x / self.width) * self.PIXEL_WIDTH
            x_1 = x_0 + self.PIXEL_WIDTH
            y_1 = y_0 + self.PIXEL_WIDTH
            hue = "#%02x%02x%02x" % self._get_rgb(self.pixels[x])
            self.canvas.create_rectangle(x_0, y_0, x_1, y_1, fill=hue)
        self.canvas.update()

    def clear(self):
        for i in range(self.width * self.height):
            self.pixels[i] = (0, 0, 0)

    def _hsv_to_rgb(self, hsv):
        rgb = colorsys.hsv_to_rgb(*hsv)
        red = self.MAX_RED * rgb[0]
        green = self.MAX_GREEN * rgb[1]
        blue = self.MAX_BLUE * rgb[2]
        return (red, green, blue)

    def _get_rgb(self, hsv):
        red, green, blue = self._hsv_to_rgb(hsv)
        red = int(float(red) / (self.MAX_RED - self.MIN_RED) * 0xFF)
        green = int(float(green) / (self.MAX_GREEN - self.MIN_GREEN) * 0xFF)
        blue = int(float(blue) / (self.MAX_BLUE - self.MIN_BLUE) * 0xFF)
        return (red, green, blue)
开发者ID:rkedge,项目名称:ColorWall,代码行数:60,代码来源:wall.py


示例19: append_algorithm

    def append_algorithm(self, algorithm):
        #To do: when algo is reset, the frm should be removed
        for algoName in self.__frameDict:
            self.__frameDict[algoName]['frame'].pack_forget()
        frm = Frame(self)
        frm.pack()
        paramInfo   = {}
        params = algorithm['parameters']
        for index, name in enumerate(params):
            param = params[name]
            paramitem = LabeledEntry(frm)
            paramitem.label_text = name
            paramitem.label_width = 5
            paramitem.entry_width = 8
            if self.balloon:
                tip = f'''{param.shortdesc}

Type: {param.type.__name__}.'''
                self.balloon.bind_widget(paramitem.label, balloonmsg=tip)
            if param.type is int:
                paramitem.checker_function = self._app.gui.value_checker.check_int
            elif param.type is float:
                paramitem.checker_function = self._app.gui.value_checker.check_float
            paramitem.grid(row=index%self.__MAXROW, column=index//self.__MAXROW)
            #self.__params[param.name] = {'gui':paramitem, 'meta':param}
            paramInfo[param.name] = {'gui':paramitem, 'meta':param}
        self.__algo = algorithm
        #self.__frameDict[algorithm.meta.name]   = frm
        self.__frameDict[algorithm['name']]   = dict(frame=frm, paramInfo=paramInfo)
        self.__params   = paramInfo
开发者ID:xialulee,项目名称:WaveSyn,代码行数:30,代码来源:singlesyn.py


示例20: GUI

class GUI(object):
    """
    The base class for GUI builder
    """

    __metaclass__ = ABCMeta

    def __init__(self, root):
        self.colorPicker = ColorPicker(root)
        self.topToolbar = Frame(root, bd=1, relief=RAISED)
        self.topToolbar.pack(side=TOP, fill=X)
        self.canvas = DrawingCanvas(root, self.colorPicker)
        self.canvas.pack(expand=YES, fill=BOTH)

    # Initializes IO and Draw commands.
    @abstractmethod
    def initButtons(self, ios, commands):
        pass

    # Event handler when users click on an IO command.
    @abstractmethod
    def onIOCommandClick(self, button, command):
        pass

    # Event handler when users click on a draw command.
    @abstractmethod
    def onDrawCommandClick(self, button, command):
        pass

    # Event handler when users change the selected color.
    @abstractmethod
    def onChangeColor(self, command):
        pass
开发者ID:tu-tran,项目名称:DrawingProjectPython,代码行数:33,代码来源:gui.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tkinter.IntVar类代码示例发布时间:2022-05-27
下一篇:
Python tkinter.Entry类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap