Entry Widget Justification - text longer than widget

我的未来我决定 提交于 2020-02-08 08:42:01

问题


I have an entry widget with a width of 60 chars. The widget is right justified. When the textvariable associated with the entry widget contains less than 60 chars, the entry widget shows the text right justified. When the textvariable is longer than 60 characters the text is left justified. I cannot insert the text from a position before the start, i.e. -34, so is this impossible to achieve?

I want to be able to display the end of the text if it's longer than the entry widget.

self.infile_var = tk.StringVar()
self.infile_e = tk.Entry(self.infile_lf,
                         textvariable=self.infile_var,
                         justify='right',
                         bd =2)

回答1:


I don't quite understand your desire to insert at a position before the start -- that doesn't make any sense. However, if all you want is for the right-most characters to be visible you can use the xview_moveto method.

self.infile_e.xview_moveto(1.0)


来源:https://stackoverflow.com/questions/30281302/entry-widget-justification-text-longer-than-widget

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