小编Dov*_*ova的帖子

为什么Tkinter中的这种形状会慢慢更新?

尝试在tkinter中进行简单的移动:

import tkinter as tk

class GameApp(object):
    """
    An object for the game window.

    Attributes:
        master: Main window tied to the application
        canvas: The canvas of this window
    """

    def __init__(self, master):
        """
        Initialize the window and canvas of the game.
        """

        self.master = master
        self.master.title = "Game"
        self.master.geometry('{}x{}'.format(500, 500))

        self.canvas = tk.Canvas(self.master)
        self.canvas.pack(side="top", fill="both", expand=True)

        self.start_game()

    #----------------------------------------------#


    def start_game(self):
        """
        Actual loading of the game.
        """

        player = Player(self)

    #----------------------------------------------#

#----------------------------------------------#


class Player(object):
    """
    The player of the game. …
Run Code Online (Sandbox Code Playgroud)

python tkinter tkinter-canvas

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

Tkinter中一个多边形的可变角数量

Tkinter忙着闲逛,想知道是否有一种方法可以创建一个具有可变数量拐角的多边形?我正在尝试编写一个程序,其中涉及用户输入一定数量的坐标,然后在画布上绘制具有这些点边缘的多边形。由于我不知道用户将输入的值的数量,因此不可能为每种可能性编写代码,那么这真的可能吗?

canvas.create_polygon(x1,y1,x2,y2...xn,yn,fill="black")
Run Code Online (Sandbox Code Playgroud)

python tkinter tkinter-canvas

0
推荐指数
1
解决办法
176
查看次数

标签 统计

python ×2

tkinter ×2

tkinter-canvas ×2