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


Python ttk.Frame类代码示例

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


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

示例1: __init__

    def __init__(self, parent):
        self.Data = Data()
        self.getReciepList()

        Frame.__init__(self, parent)

        self.parent = parent

        self.recipeList = None  # Listbox
        self.recipeName = None  # Entry
        self.prepTime = None  # Entry
        self.prepTimeUnit = None  # OptionMenu
        self.cookTime = None  # Entry
        self.cookTimeUnit = None  # OptionMenu
        self.ingredientName = None  # Entry
        self.ingredientQuantity = None  # Entry
        self.ingredientUnit = None  # OptionMenu
        self.ingredientList = None  # Listbox
        self.procedure = None  # Text

        self.recipes = []
        self.ingredients = []
        self.activeRecipeID = {"lst": None, "db": None}  # (listID, dbID)
        self.activeIngredientID = {"lst": None, "db": None}  # (listID, dbID)

        self.initUI()

        self.bind_all("<Control-w>", self.onExit)
        self.bind_all("<Control-s>", self.recipeSave)
开发者ID:RagingRoosevelt,项目名称:RecipeManagerV2,代码行数:29,代码来源:gui.py

示例2: initialize

    def initialize(self):
        self.top = Frame(self.canvas)
        self.top.grid(row=0,column=0, columnspan=3, padx=5, pady=10)

        self.label = Label(self.top, text="PATH :", anchor="w", fg="black")
        self.label.pack(side=LEFT)

        self.pathEntry = Entry(self.top, textvariable=self.trackPath, width="75")
        self.pathEntry.pack(side=LEFT, padx=5)


        self.sliderFrame = Frame(self.canvas)
        self.sliderFrame.grid(row=1, column=0,columnspan=4, pady=10, padx=5)


        for i in range(10):
            slider = SliderFrequency(self.sliderFrame, self.freqs[i],10.0,0.0,20.0, i)
            self.sliders.append(slider)


        self.infoLabel = Label(self.canvas, text="", textvariable=self.info)
        self.infoLabel.grid(row=2, column=0,columnspan=2)
        self._afficheInfo("Choose music to equalize")

        self.startBtn = Button(self.canvas, text="Start", command=self.start)
        self.startBtn.grid(row=2, column=2, pady=10)
        self.startBtn = Button(self.canvas, text="Reset", command=self.reset)
        self.startBtn.grid(row=2, column=3, pady=10)
开发者ID:Gorgorot38,项目名称:Sonotone-RICM4,代码行数:28,代码来源:Graphic_EQ.py

示例3: add_buttons

 def add_buttons(self):
     frame = Frame(self)
     frame.pack(fill="x")
     edit = Button(frame, text="Edit", command=self.edit)
     edit.pack(side="right", padx=5, pady=5)
     delete = Button(frame, text="Del", command=self.delete_menu)
     delete.pack(side="right")
开发者ID:Exodus111,项目名称:Projects,代码行数:7,代码来源:mod_items.py

示例4: __init__

    def __init__(self, parent, i, j, callback_edit, **options):
        Frame.__init__(self, parent, **options)
        # grid layout
        self.rowconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)
        self.rowconfigure(2, weight=1)
        self.columnconfigure(0, weight=1)
        self.columnconfigure(1, weight=1)
        self.columnconfigure(2, weight=1)
        # styles
        self.configure(style="case.TFrame")

        self.i = i
        self.j = j
        self.modifiable = True
        self.val = 0 # valeur de la case, 0 = vide
        self.possibilites = [] # possibilites écrites dans la case
        self.callback_edit = callback_edit

        # labels
        self.chiffres = [] # tableau 3x3 de labels permettant d'afficher les chiffres dans la case
        sticky_i = ["n", "ns", "s"]
        sticky_j = ["w", "ew", "e"]
        for i in range(3):
            self.chiffres.append([])
            for j in range(3):
                self.chiffres[i].append(Label(self, text=" ", anchor="center",
                                                  style="case.TLabel", width=1))
                self.chiffres[i][j].grid(row=i, column=j,
                                         sticky=sticky_i[i % 3] + sticky_j[j % 3],
                                         padx=1, pady=1)
开发者ID:j4321,项目名称:Sudoku-Tk,代码行数:31,代码来源:case.py

示例5: __init__

    def __init__(self, parentWindow, title=None, okText=None, cancelText=None, geometry=None):

        tk.Toplevel.__init__( self, parentWindow )
        self.transient( parentWindow )

        self.parentWindow = parentWindow
        if title: self.title( title )

        self.result = None # Used to return an optional result

        if okText is None: okText = _("Ok")
        self.okText = okText
        if cancelText is None: cancelText = _("Cancel")
        self.cancelText = cancelText
        self.makeButtonBox()

        body = Frame( self )
        self.initial_focus = self.makeBody( body ) # Create the widgets in the body
        body.pack( padx=5, pady=5, fill=tk.BOTH, expand=tk.YES )

        self.grab_set()

        if not self.initial_focus:
            self.initial_focus = self

        self.protocol( 'WM_DELETE_WINDOW', self.cancel ) # Ensure that closing the dialog does a cancel

        self.geometry( geometry if geometry else "+{}+{}".format(parentWindow.winfo_rootx()+50, parentWindow.winfo_rooty()+50) )

        self.parentWindow.parentApp.setStatus( _("Waiting for user input…") )
        self.initial_focus.focus_set()
        self.wait_window( self )
开发者ID:openscriptures,项目名称:Biblelator,代码行数:32,代码来源:ModalDialog.py

示例6: initUI

    def initUI(self, server):
      
        self.parent.title("TrackWise Service Manager")
        self.pack(fill=BOTH, expand = True, padx = 300)
        # self.centerWindow()

        menubar = Menu(self.parent)
        self.parent.config(menu = menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label = "Exit", command = self.onExit)
        menubar.add_cascade(label = "File", menu = fileMenu)

        svcsMenu = Menu(menubar)
        svcsMenu.add_command(label = "List Service Status", command = self.onStatus)
        svcsMenu.add_command(label = "Stop Services", command = self.onStop)
        svcsMenu.add_command(label = "Start Services", command = self.onStart)
        menubar.add_cascade(label = "Services", menu = svcsMenu)

        # svcs = ['TrackWise Tomcat', 'Web Services Tomcat', 'QMD Tomcat', 'Keystone Intake', 'ID Intake', 'TWC']
        svcs = server.getservices()
        hostname = server.gethostname().strip()
        servertype = server.gettype().strip()

        frame0 = Labelframe(self, text = "Server Details",  borderwidth = 1)
        frame0.grid(column = 0, row = 0, sticky = W)
        
        so = StringVar()
        svroverview = Message(frame0, textvariable = so, anchor = W, width = 300)
        svroverview.grid(column = 0, row = 0)
        sstr = "Server: {}\n".format(hostname)
        sstr += "Server Type: {}".format(servertype)
        so.set(sstr)
        
        
        frame1 = Labelframe(self, text = "Service Status", borderwidth = 1)
        frame1.grid(column = 0, row = 1, sticky = W)


        l = StringVar()
        label1 = Message(frame1, textvariable = l , anchor = W)
        
        svcscount = 0

        lstr = ""

        for i in svcs:
            svcscount += 1 
            lstr += '{} - '.format(i) + ('UP\n' if svcscount % 2 else 'DOWN\n')
      
            
        l.set(lstr)
        label1.pack(side=TOP, padx = 5, pady = 5)   

        frame4 = Frame(self, relief=RAISED, borderwidth = 1)
        frame4.grid(column = 0, row = 2, sticky = W)
        closeButton = Button(frame4, text="Close", command = self.quit)
        closeButton.grid(column = 0, row = 0)
        okButton = Button(frame4, text = "OK")
        okButton.grid(column = 1, row = 0)
开发者ID:HarryTheBadger,项目名称:TWBatMan,代码行数:60,代码来源:ui.py

示例7: __init__

    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent
        self.grid(sticky=N+E+S+W)

        self.initui()
开发者ID:arran-dengate,项目名称:light-pollution,代码行数:7,代码来源:controller.py

示例8: __init__

 def __init__(self, master):
     Frame.__init__(self, master, padding="0 0 0 13")
     Separator(self).grid(row=0, columnspan=2, pady="0 9", sticky=EW)
     self.button = Button(self, text="Close", command=master.destroy)
     self.button.grid(row=1, column=0, padx="15", sticky=E)
     self.grid(sticky=EW)
     self.columnconfigure(0, weight=1)
开发者ID:jwdafoe,项目名称:ContactPro,代码行数:7,代码来源:gui.py

示例9: initialize_ui

  def initialize_ui(self):
    default_padding = {'padx': 10, 'pady' : 10}

    customer_frame = Frame(self)
    self.customer_id_label = Label(customer_frame, text = "Customer id:", style="BW.TLabel")
    self.customer_id_label.pack(default_padding, side = LEFT)

    self.customer_id_value = Label(customer_frame,style="BW.TLabel")
    self.customer_id_value["textvariable"] = self.controller.customer_id
    self.customer_id_value.pack(default_padding, side = LEFT)

    customer_frame.pack(expand = True, fill = "x")

    self.take_picture_frame = Frame(self, border = 10)
    
    self.picture_mode = IntVar()
    Radiobutton(self.take_picture_frame, text = "Light", variable = self.picture_mode, value = 1).pack(side = LEFT)
    Radiobutton(self.take_picture_frame, text = "Dark", variable = self.picture_mode, value = 2).pack(side = LEFT)
    
    self.button_take_picture = Button(self.take_picture_frame, text = "Take picture", command = self.take_picture)
    self.button_take_picture.pack(expand = True, fill = "x", side = BOTTOM)

    self.take_picture_frame.pack(expand = True)
    
    self.button_update = Button(self, text = "Update", command = self.controller.run_update_script)
    self.button_update.pack(expand = True, fill = "x")
开发者ID:khlumzeemee,项目名称:3dprinter,代码行数:26,代码来源:ApplicationMVC.py

示例10: __init__

    def __init__(self, parent, title=None, okText=None, cancelText=None):

        tk.Toplevel.__init__( self, parent )
        self.transient( parent )

        self.parent = parent
        if title: self.title( title )

        if okText is None: okText = _("Ok")
        self.okText = okText
        if cancelText is None: cancelText = _("Cancel")
        self.cancelText = cancelText

        self.result = None # Used to return an optional result

        body = Frame( self )
        self.initial_focus = self.body( body ) # Create the widgets in the 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 ) # Ensure that closing the dialog does a cancel

        self.geometry( "+{}+{}".format(parent.winfo_rootx()+50, parent.winfo_rooty()+50) )

        self.parent.parentApp.setStatus( _("Waiting for user input...") )
        self.initial_focus.focus_set()
        self.wait_window( self )
开发者ID:alerque,项目名称:Biblelator,代码行数:33,代码来源:ModalDialog.py

示例11: __init__

    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent 

        self.music_root = ''
        self.query_path = ''
        self.extractor = Extractor(n_frames=40, 
                                   n_blocks=100, 
                                   learning_rate=0.00053,
                                   verbose=True)

        self.style = Style()
        self.style.theme_use("default")
        
        padx = 2
        pady = 2

        root_select_button = Button(self, text="Select a directory")
        root_select_button.pack(fill=tkinter.X, padx=padx, pady=pady)
        root_select_button.bind("<Button-1>", self.set_music_root)

        analyze_button = Button(self, text="Analyze")
        analyze_button.pack(fill=tkinter.X, padx=padx, pady=pady)
        analyze_button.bind("<Button-1>", self.analyze)

        query_select_button = Button(self, text="Select a file")
        query_select_button.pack(fill=tkinter.X, padx=padx, pady=pady)
        query_select_button.bind("<Button-1>", self.set_query_path)

        search_button = Button(self, text="Search similar songs")
        search_button.pack(fill=tkinter.X, padx=padx, pady=pady)
        search_button.bind("<Button-1>", self.search_music)
 
        self.pack(fill=BOTH, expand=1)
开发者ID:IshitaTakeshi,项目名称:Lyra,代码行数:35,代码来源:gui.py

示例12: __init__

    def __init__(self, master):
        """Construct a Box frame with parent master.

        Args:
            master: The parent frame.
        """
        Frame.__init__(self, master, style=styles.BOX_FRAME)
        self.position = (0, 0)
        self.binding_tag = 'BoxFrame' + str(Box._counter)
        self.number_text = StringVar(self, '')
        Box._counter += 1

        self.borders = dict()
        for edge in 'nesw':
            self.borders[edge] = Border(self, edge)

        self.inner_frame = Frame(self, width=30, height=30, style=styles.BOX_FRAME)
        self.pencil_marks = _build_3x3_grid(self.inner_frame, Pencil)

        self.label = Label(self.inner_frame, textvariable=self.number_text, style=styles.NUMBER_LABEL)

        _tag_widget(self, self.binding_tag)
        _tag_widget(self.inner_frame, self.binding_tag)
        _tag_widget(self.label, self.binding_tag)
        for mark in self.pencil_marks:
            _tag_widget(mark, self.binding_tag)
            _tag_widget(mark.label, self.binding_tag)
开发者ID:Tinister,项目名称:SudokuSolver,代码行数:27,代码来源:frames.py

示例13: __init__

    def __init__(self, master, origin=(0, 0)):
        Frame.__init__(self, master)
        self.origin = origin
        self.goban = golib.gui.Goban(self)
        self.buttons = Frame(self)
        self.ctx_event = None  # save the event that has originated the context menu
        self.msg = tk.StringVar(value="Hello")
        self.err = tk.StringVar(value="-")
        self.create_menubar()
        self.init_components()

        self.closed = False

        # user input part of the gui, delegated to goban ATM. may become lists later
        self.mousein = self.goban
        self.keyin = self.goban

        # these commands are expected to be set from outside, in an attempt to inject dependency via setter.
        # See 'controller' classes who instantiate some of these commands.
        self.commands = {}
        self.master.protocol("WM_DELETE_WINDOW", lambda: self.execute("close"))
        self.commands["close"] = lambda: self.master.quit()  # this command needs a default value

        # delegate some work to goban
        self.stones_changed = self.goban.stones_changed
        self.highlight = self.goban.highlight
        self.select = self.goban.select
        self.clear = self.goban.clear
开发者ID:ArnaudPel,项目名称:Golib,代码行数:28,代码来源:ui.py

示例14: __init__

 def __init__(self, parent, title, imageFile, body):
     super(DialogAbout, self).__init__(parent)
     self.parent = parent
     parentGeometry = re.match("(\d+)x(\d+)[+]?([-]?\d+)[+]?([-]?\d+)", parent.geometry())
     dialogX = int(parentGeometry.group(3))
     dialogY = int(parentGeometry.group(4))
     self.transient(self.parent)
     self.title(title)
     
     frame = Frame(self)
     image = PhotoImage(file=imageFile)
     aboutImage = Label(frame, image=image)
     aboutBody = Label(frame, text=body, wraplength=500)
     okButton = Button(frame, text=_("OK"), command=self.ok)
     okButton.focus_set()
     aboutImage.grid(row=0, column=0, sticky=NW, pady=20, padx=16)
     aboutBody.grid(row=0, column=1, columnspan=2, sticky=EW, pady=3, padx=0)
     okButton.grid(row=1, column=2, sticky=EW, pady=3)
     
     frame.grid(row=0, column=0, sticky=(N,S,E,W))
     frame.columnconfigure(1, weight=1)
     window = self.winfo_toplevel()
     window.columnconfigure(0, weight=1)
     self.geometry("+{0}+{1}".format(dialogX+200,dialogY+200))
     
     self.bind("<Alt-u>", lambda *ignore: okButton.focus_set())
     self.bind("<Return>", self.ok)
     self.bind("<Escape>", self.close)
     
     self.protocol("WM_DELETE_WINDOW", self.close)
     self.grab_set()
     self.wait_window(self)
开发者ID:DaveInga,项目名称:Arelle,代码行数:32,代码来源:DialogAbout.py

示例15: __init__

    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()
开发者ID:sulir,项目名称:treepace,代码行数:27,代码来源:gui.py


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