tkinter 标签图像在固定位置 [英] tkinter label's image in fixed position

查看:69
本文介绍了tkinter 标签图像在固定位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用

self.exampleLabel = tk.Label(self,image=self.exampleImage,
                            text="test",compound="left")

创建一个标签列表,我现在得到的是:我想知道除了将它们放在另一列标签中之外,有没有一种方法可以让我对齐星星?

to create a list of labels and what I got now is: I was wondering is there a way that can enable me to align the star except for put them in another column of labels?

谢谢!

推荐答案

您可以将所有图像对齐到最左侧或最右侧,但标签没有列的概念.但是,如果您使用的所有图像都具有相同的尺寸,则可以使它看起来像有两列.

You can make it so that all of the images align to the far left or right, but the label has no concept of columns. You can make it appear like there are two columns if all of the images you use have the same dimensions, however.

如果您希望它们位于最左侧,请将 anchor='w' 添加到标签,这将导致标签内容(图像和文本)锚定"到小部件的西侧.

If you want them to be to the far left, add anchor='w' to the label, which will cause the label contents (both image and text) to be "anchored" to the west side of the widget.

这篇关于tkinter 标签图像在固定位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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