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


Python tkinter.Frame方法代码示例

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


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

示例1: _sb_canvas

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def _sb_canvas(self, root, expand='y',
                   fill='both', side='bottom'):
        """
        Helper for __init__: construct a canvas with a scrollbar.
        """
        cframe =tkinter.Frame(root, relief='sunk', border=2)
        cframe.pack(fill=fill, expand=expand, side=side)
        canvas = tkinter.Canvas(cframe, background='#e0e0e0')

        # Give the canvas a scrollbar.
        sb = tkinter.Scrollbar(cframe, orient='vertical')
        sb.pack(side='right', fill='y')
        canvas.pack(side='left', fill=fill, expand='yes')

        # Connect the scrollbars to the canvas.
        sb['command']= canvas.yview
        canvas['yscrollcommand'] = sb.set

        return (sb, canvas) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:21,代码来源:chartparser_app.py

示例2: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def __init__(self, master=None):
        tk.Frame.__init__(self, master)
        self.master = master
        self.init_window()
        
        self.about_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/LPHK-banner.png"))
        self.info_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/info.png"))
        self.warning_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/warning.png"))
        self.error_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/error.png"))
        self.alert_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/alert.png"))
        self.scare_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/scare.png"))
        self.grid_drawn = False
        self.grid_rects = [[None for y in range(9)] for x in range(9)]
        self.button_mode = "edit"
        self.last_clicked = None
        self.outline_box = None 
开发者ID:nimaid,项目名称:LPHK,代码行数:18,代码来源:window.py

示例3: build_buttons

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def build_buttons(self):
        btn_args = dict(
            height=1,
        )
        btn_group = tk.Frame(self)

        buttons = [
            tk.Button(
                btn_group,
                text=text,
                command=command,
                **btn_args
            )
            for text, command in (
                ("开始下载", self.start_download),
                ("停止下载", self.stop_download),
                ("打开下载文件夹", self.open_download_folder),
            )
        ]

        for index, btn in enumerate(buttons):
            btn.grid(column=index, row=0, sticky=tk.N)

        btn_group.pack(fill=tk.BOTH, expand=1)
        return btn_group 
开发者ID:winkidney,项目名称:PickTrue,代码行数:27,代码来源:downloader.py

示例4: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def __init__(self):
        super().__init__()
        self.title("Blackjack")
        self.geometry("800x640")
        self.resizable(False, False)

        self.bottom_frame = tk.Frame(self, width=800, height=140, bg="red")
        self.bottom_frame.pack_propagate(0)

        self.hit_button = tk.Button(self.bottom_frame, text="Hit", width=25, command=self.hit)
        self.stick_button = tk.Button(self.bottom_frame, text="Stick", width=25, command=self.stick)

        self.next_round_button = tk.Button(self.bottom_frame, text="Next Round", width=25, command=self.next_round)
        self.quit_button = tk.Button(self.bottom_frame, text="Quit", width=25, command=self.destroy)

        self.new_game_button = tk.Button(self.bottom_frame, text="New Game", width=25, command=self.new_game)

        self.bottom_frame.pack(side=tk.BOTTOM, fill=tk.X)

        self.game_screen = GameScreen(self, bg="white", width=800, height=500)
        self.game_screen.pack(side=tk.LEFT, anchor=tk.N)
        self.game_screen.setup_opening_animation() 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Programming-by-Example,代码行数:24,代码来源:ch4.py

示例5: show_friends

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def show_friends(self):
        self.configure(menu=self.menu)
        self.login_frame.pack_forget()

        self.canvas = tk.Canvas(self, bg="white")
        self.canvas_frame = tk.Frame(self.canvas)

        self.scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.canvas.yview)
        self.canvas.configure(yscrollcommand=self.scrollbar.set)

        self.scrollbar.pack(side=tk.LEFT, fill=tk.Y)
        self.canvas.pack(side=tk.LEFT, expand=1, fill=tk.BOTH)

        self.friends_area = self.canvas.create_window((0, 0), window=self.canvas_frame, anchor="nw")

        self.bind_events()

        self.load_friends() 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Programming-by-Example,代码行数:20,代码来源:friendslist.py

示例6: load_friends

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def load_friends(self):
        all_users = self.requester.get_all_users()

        for user in all_users:
            if user['username'] != self.username:
                friend_frame = ttk.Frame(self.canvas_frame)

                profile_photo = tk.PhotoImage(file="images/avatar.png")
                profile_photo_label = ttk.Label(friend_frame, image=profile_photo)
                profile_photo_label.image = profile_photo

                friend_name = ttk.Label(friend_frame, text=user['real_name'], anchor=tk.W)

                message_this_friend = partial(self.open_chat_window, username=user["username"], real_name=user["real_name"])

                message_button = ttk.Button(friend_frame, text="Chat", command=message_this_friend)

                profile_photo_label.pack(side=tk.LEFT)
                friend_name.pack(side=tk.LEFT)
                message_button.pack(side=tk.RIGHT)

                friend_frame.pack(fill=tk.X, expand=1) 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Programming-by-Example,代码行数:24,代码来源:friendslist.py

示例7: load_friends

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def load_friends(self):
        friend_frame = ttk.Frame(self.canvas_frame)

        profile_photo = tk.PhotoImage(file="images/avatar.png")
        profile_photo_label = ttk.Label(friend_frame, image=profile_photo)
        profile_photo_label.image = profile_photo

        friend_name = ttk.Label(friend_frame, text="Jaden Corebyn", anchor=tk.W)

        message_button = ttk.Button(friend_frame, text="Chat", command=self.open_chat_window)

        profile_photo_label.pack(side=tk.LEFT)
        friend_name.pack(side=tk.LEFT)
        message_button.pack(side=tk.RIGHT)

        friend_frame.pack(fill=tk.X, expand=1) 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Programming-by-Example,代码行数:18,代码来源:friendslist.py

示例8: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def __init__(self, width=500, height=300):
        TkBase.__init__(self, width, height)
        self.plist_path = tk.StringVar()
        self.plist_path.set(os.path.abspath('.'))

        frame0 = tk.Frame(self.window)
        frame0.pack()

        frame1 = tk.Frame(self.window)
        frame1.pack()

        frame2 = tk.Frame(self.window)
        frame2.pack()

        self.__make_title_info(frame0, 0, 0)
        self.__make_title(frame1, 0, 1, 'Andromeda.plist 文件目录')
        self.__make_title_empty(frame1, 1, 0)
        self.__make_select_text(frame1, 1, 1, 1, self.plist_path)

        self.__make_title_empty(frame2, 0, 0)
        self.__make_select_confirm(frame2, 1, 0)

        self.window.mainloop() 
开发者ID:liucaide,项目名称:Andromeda,代码行数:25,代码来源:ui_launch.py

示例9: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def __init__(self, parent, property_dict, *args, **kw):
        tk.Frame.__init__(self, parent, *args, **kw)

        # create a canvas object and a vertical scrollbar for scrolling it
        self.vscrollbar = vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL)
        vscrollbar.pack(fill=tk.Y, side=tk.RIGHT, expand=tk.FALSE)
        self.canvas = canvas = tk.Canvas(self, bd=0, highlightthickness=0,
                        yscrollcommand=vscrollbar.set)
        canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=tk.TRUE)
        vscrollbar.config(command=canvas.yview)

        # reset the view
        canvas.xview_moveto(0)
        canvas.yview_moveto(0)

        # create a frame inside the canvas which will be scrolled with it
        self.interior = interior = tk.Frame(canvas)
        self.interior_id = canvas.create_window(0, 0, window=interior,
                                           anchor='nw')

        self.interior.bind('<Configure>', self._configure_interior)
        self.canvas.bind('<Configure>', self._configure_canvas)

        self.build(property_dict) 
开发者ID:jsexauer,项目名称:networkx_viewer,代码行数:26,代码来源:viewer.py

示例10: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def __init__(self, image, initialField, initialText):
        frm = tk.Frame(root)
        frm.config(background="white")
        self.image = tk.PhotoImage(format='gif',data=images[image.upper()])
        self.imageDimmed = tk.PhotoImage(format='gif',data=images[image])
        self.img = tk.Label(frm)
        self.img.config(borderwidth=0)
        self.img.pack(side = "left")
        self.fld = tk.Text(frm, **fieldParams)
        self.initScrollText(frm,self.fld,initialField)
        frm = tk.Frame(root)
        self.txt = tk.Text(frm, **textParams)
        self.initScrollText(frm,self.txt,initialText)
        for i in range(2):
            self.txt.tag_config(colors[i], background = colors[i])
            self.txt.tag_config("emph"+colors[i], foreground = emphColors[i]) 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:18,代码来源:nemo_app.py

示例11: create_puzzle_frame

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def create_puzzle_frame(parent_frame, n, current_puzzle_frame=None, read_only=False):
    """
    Creates a new puzzle frame inside a parent frame and if the puzzle frame already exists, first destroys it.
    This is done because when the n changes we have to change the puzzle frame's grid row and column configurations
    and it turned out in tkinter it can be done by recreating the frame widget!

    Returns the newly created puzzle frame.
    """
    if current_puzzle_frame:
        current_puzzle_frame.destroy()

    puzzle_frame = tkinter.Frame(parent_frame)
    puzzle_frame.grid(row=0, column=0, sticky='WENS')

    draw_puzzle(puzzle_frame, n, read_only)

    return puzzle_frame 
开发者ID:mahdavipanah,项目名称:pynpuzzle,代码行数:19,代码来源:pynpuzzle.py

示例12: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def __init__(self, parent, **kwargs):
        tk.Frame.__init__(self, parent, **kwargs)
        
        self.parent = parent
        self.degree = 5
        
        self.graphFigure = Figure(figsize=(4,2), dpi=100, facecolor="black")
        
        self.subplot = self.graphFigure.add_subplot(1,1,1, facecolor=(0.3, 0.3, 0.3))
        self.subplot.tick_params(axis="y", colors="grey", direction="in")
        self.subplot.tick_params(axis="x", colors="grey", labelbottom="off", bottom="off")
        
        self.graphFigure.axes[0].get_xaxis().set_ticklabels([])
        self.graphFigure.subplots_adjust(left=(30/100), bottom=(15/100), 
                                         right=1, top=(1-15/100), wspace=0, hspace=0)

        self.canvas = FigureCanvasTkAgg(self.graphFigure, self)
        self.canvas.get_tk_widget().configure(bg="black")
        self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
        
        self.canvas.show() 
开发者ID:ArtificialQualia,项目名称:PyEveLiveDPS,代码行数:23,代码来源:graph.py

示例13: addDraggableEdges

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def addDraggableEdges(self):
        self.childWindow.topResizeFrame = tk.Frame(self.childWindow, height=5, background="black", cursor="sb_v_double_arrow")
        self.childWindow.topResizeFrame.grid(row="0", column="1", columnspan="50", sticky="ew")
        self.childWindow.topResizeFrame.bind("<ButtonPress-1>", self.StartMove)
        self.childWindow.topResizeFrame.bind("<ButtonRelease-1>", self.StopMove)
        self.childWindow.topResizeFrame.bind("<B1-Motion>", self.OnMotionResizeYTop)
        
        self.childWindow.bottomResizeFrame = tk.Frame(self.childWindow, height=5, background="black", cursor="sb_v_double_arrow")
        self.childWindow.bottomResizeFrame.grid(row="20", column="1", columnspan="50", sticky="ew")
        self.childWindow.bottomResizeFrame.bind("<ButtonPress-1>", self.StartMove)
        self.childWindow.bottomResizeFrame.bind("<ButtonRelease-1>", self.StopMove)
        self.childWindow.bottomResizeFrame.bind("<B1-Motion>", self.OnMotionResizeYBottom)
        
        self.childWindow.leftResizeFrame = tk.Frame(self.childWindow, width=5, background="black", cursor="sb_h_double_arrow")
        self.childWindow.leftResizeFrame.grid(row="1", column="0", rowspan="50", sticky="ns")
        self.childWindow.leftResizeFrame.bind("<ButtonPress-1>", self.StartMove)
        self.childWindow.leftResizeFrame.bind("<ButtonRelease-1>", self.StopMove)
        self.childWindow.leftResizeFrame.bind("<B1-Motion>", self.OnMotionResizeXLeft)
        
        self.childWindow.rightResizeFrame = tk.Frame(self.childWindow, width=5, background="black", cursor="sb_h_double_arrow")
        self.childWindow.rightResizeFrame.grid(row="1", column="20", rowspan="50", sticky="ns")
        self.childWindow.rightResizeFrame.bind("<ButtonPress-1>", self.StartMove)
        self.childWindow.rightResizeFrame.bind("<ButtonRelease-1>", self.StopMove)
        self.childWindow.rightResizeFrame.bind("<B1-Motion>", self.OnMotionResizeXRight) 
开发者ID:ArtificialQualia,项目名称:PyEveLiveDPS,代码行数:26,代码来源:baseWindow.py

示例14: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def __init__(self, parent, mainWindow, **kwargs):
        tk.Frame.__init__(self, parent, **kwargs)
        self.parent = parent
        self.mainWindow = mainWindow
        self.columnconfigure(1, weight=1)
        
        tk.Frame(self, height="20", width="10").grid(row="0", column="1", columnspan="2")
        
        checkboxValue = tk.BooleanVar()
        checkboxValue.set(settings.detailsWindowShow)
        self.windowDisabled = tk.Checkbutton(self, text="Show Pilot Breakdown window", variable=checkboxValue)
        self.windowDisabled.var = checkboxValue
        self.windowDisabled.grid(row="1", column="1", columnspan="2")
        
        tk.Frame(self, height="20", width="10").grid(row="2", column="1", columnspan="2")
        
        self.makeListBox() 
开发者ID:ArtificialQualia,项目名称:PyEveLiveDPS,代码行数:19,代码来源:detailSettingsFrame.py

示例15: makeGrids

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Frame [as 别名]
def makeGrids(self):
        self.gridFrameLeft = tk.Frame(self)
        self.gridListLeft = [[self.makeGridBlock(self.gridFrameLeft, row, i) for row in range(8)] for i in range(self.gridColumns[0])]
        self.gridFrameLeft.grid(row="5", column="1", padx="10")
        
        self.gridFrameRight = tk.Frame(self)
        self.gridListRight = [[self.makeGridBlock(self.gridFrameRight, row, i) for row in range(8)] for i in range(self.gridColumns[1])]
        self.gridFrameRight.grid(row="5", column="3", padx="10")
        
        for item, entries in self.labels.items():
            row = entries["row"]
            column = entries["column"]
            title = self.text[item]
            try:
                GridEntry(self.gridListLeft[column][row], 
                            title, entries["decimalPlaces"], entries["inThousands"])
            except IndexError:
                column = column - len(self.gridListLeft)
                GridEntry(self.gridListRight[column][row], 
                            title, entries["decimalPlaces"], entries["inThousands"]) 
开发者ID:ArtificialQualia,项目名称:PyEveLiveDPS,代码行数:22,代码来源:labelSettingsFrame.py


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