简体   繁体   English

python ttk.Entry如何使输入居中

[英]python ttk.Entry how to center the input

我的应用的截图

Here is a screenshot of a program I am writing using Python Tkinter. 这是我使用Python Tkinter编写的程序的屏幕截图。 I use ttk.Entry widget to get the user input. 我使用ttk.Entry小部件来获取用户输入。

I would like to know how to center the input in the Entry (as you can see, the input is now stuck to the left part of the widget) 我想知道如何将Entry的输入居中 (如您所见,输入现在卡在小部件的左侧部分)

Entry widgets take the option justify , which for centered text should be 'center' . 条目小部件采用选项justify ,对于居中文本应该是'center' When creating the widget, do something like 在创建小部件时,执行类似的操作

e = ttk.Entry(master, ..., justify='center')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM