小编Bal*_*ler的帖子

Tkinter的!了解如何切换帧

我试图教我自己如何使用tkinter,我通过youtube发现了一个有用的代码,我并不完全理解.如果有人能帮助我理解它,我将不胜感激.标记我不理解的事情**

import tkinter as tk  # why not from tkinter import? **

class SampleApp(tk.Tk): tk.TK**

    def __init__(self, *args, **kwargs):
        tk.Tk.__init__(self, *args, **kwargs)

        # the container is where we'll stack a bunch of frames
        # on top of each other, then the one we want visible
        # will be raised above the others

        container = tk.Frame(self) *
        container.pack(side="top", fill="both", expand=True)
        container.grid_rowconfigure(0, weight=1)
        container.grid_columnconfigure(0, weight=1)

        self.frames = {}
        for F in (StartPage, PageOne, PageTwo):
            page_name = F.__name__
            frame = F(container, self) ** …
Run Code Online (Sandbox Code Playgroud)

tkinter python-3.x

6
推荐指数
1
解决办法
9302
查看次数

标签 统计

python-3.x ×1

tkinter ×1