tkinter label's image in fixed position

限于喜欢 提交于 2021-01-29 04:47:36

问题


I'm using

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?

Thanks!


回答1:


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.

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.



来源:https://stackoverflow.com/questions/40997154/tkinter-labels-image-in-fixed-position

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!