小编Tho*_*dre的帖子

调整 Python Tkinter 网格的部分大小

我只是想知道是否有办法使用 tkinter 抓取并调整网格小部件的一列或一行的大小(当您抓取窗口的边框并拉动它以调整窗口大小时)。

我想到了一个按钮,也许是一个按下的事件或其他什么,但我不知道如何将鼠标位置转换为列宽或行高。

我想抓取和调整大小的红色箭头]:

在此处输入图片说明

def initUI(self):
    self.parent["bg"] = self.main_color
    self.parent.title("Super Pipe")
    self.grid(sticky = N + S + E + W)

    self.parent.bind("<F5>", self.refresh)

    menu_bar = Menu(self.parent)

    menu_file = Menu(menu_bar, tearoff = 0)
    menu_file.add_command(label="New project", command = self.newProjectCommand)
    menu_file.add_command(label="Set project", command = self.setProjectCommand)
    menu_file.add_separator()
    menu_file.add_command(label="Quit", command = self.parent.destroy)
    menu_bar.add_cascade(label="File", menu = menu_file)

    menu_edit = Menu(menu_bar, tearoff = 0)
    menu_edit.add_command(label = "Clean backups", command = self.cleanBackupsCommand)
    menu_edit.add_command(label = "Clean student versions", command = self.cleanStudentCommand)
    menu_edit.add_separator()
    menu_edit.add_command(label = "Project settings", command = self.projectSettingsCommand) …
Run Code Online (Sandbox Code Playgroud)

python grid resize tkinter

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

标签 统计

grid ×1

python ×1

resize ×1

tkinter ×1