在窗口中定位画布 - Tkinter/python [英] Positioning Canvas in window - Tkinter/python

查看:34
本文介绍了在窗口中定位画布 - Tkinter/python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在窗口中放置画布并在它周围放置一个框架?我只找到了如何在画布内放置对象的方法.

Is there a way to position a canvas in a window and have a frame around it?I found only how to position objects inside a canvas.

推荐答案

您可以创建一个框架,然后将您的小部件放入其中:

You can create a frame, then put your widgets in it:

f = tk.Frame(...)
c1 = tk.Canvas(f, ...)
c2 = tk.Canvas(f, ...)
c1.pack(side="left", fill="both", expand=True)
c2.pack(side="right", fill="both", expand=True)

以上将在单个框架内为您提供两个并排的画布.当您调整包含窗口的大小时,它们会增大和缩小.

The above will give you two side-by-side canvases inside a single frame. They will grow and shrink as you resize the containing window.

这篇关于在窗口中定位画布 - Tkinter/python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆