相关疑难解决方法(0)

Tkinter标签小部件中的下划线文字?

我正在开发一个项目,要求我在Tkinter Label小部件中为某些文本加下划线.我知道可以使用下划线方法,但我似乎只能根据参数强调小部件的1个字符.即

p = Label(root, text=" Test Label", bg='blue', fg='white', underline=0)

change underline to 0, and it underlines the first character, 1 the second etc
Run Code Online (Sandbox Code Playgroud)

我需要能够强化小部件中的所有文本,我确信这是可能的,但是如何?

我在Windows 7上使用Python 2.6.

python windows label tkinter underline

12
推荐指数
4
解决办法
2万
查看次数

查找除已使用的锚以外的另一个锚的位置

我创建了一个代码来显示我的问题。看起来像这样:

userNameID = tkinter.Label(root, text="Name/ID")
userNameID.place(x=640, y=320, anchor="e")

userNameID = tkinter.Label(root, text="Password")
userNameID.place(x=640, y=360, anchor="e")

entButton = tkinter.Button(root, text="Enter", command=enterPrint)
entButton.place(x=640, y=400, anchor="w")
Run Code Online (Sandbox Code Playgroud)

问题是我在中心的一个尺寸上对齐了一些文本,在另一侧对齐了一个按钮。我想知道文本的西北锚的位置,以确保所有内容与中心的距离均相同,并且仍然对齐。

python tkinter python-3.x

3
推荐指数
1
解决办法
124
查看次数

标签 统计

python ×2

tkinter ×2

label ×1

python-3.x ×1

underline ×1

windows ×1