我一直在做一个检查语法的脚本。现在我要用它来更新。问题是,我试图指出语法错误的那一行,而当我使用输入字段输入文本时,所有内容都在一行中。在
我的问题是如何扩展输入字段?
这是我的代码:
import re
from tkinter import *
window = Tk()
window.minsize(width=300, height= 20)
wr = []
def work():
x = e1.get()
print(x)
BigLetterSearcher = re.compile(r'\. .|\n')
mo = BigLetterSearcher.findall(e1.get())
x = 1
y = 0
v = 0
z = ""
wr = []
for i in mo:
if i == '\n':
x += 1
elif i != i.upper():
v = 1
if x != y:
z = "Row", x
wr.append(z)
wr.append(i)
y = x
if v == 0:
wr.append ("Congratulations none of your grammar was wrong!")
l1.configure(text=wr)
l1 = Label(window, text="example")
e1 = Entry(window, text="Enter text here: ")
b1 = Button(window, text="Work", command=work)
leb = [l1, e1, b1]
for all in leb:
all.pack()
window.mainloop()
垂直扩展一个输入字段只能通过改变与输入字段相关联的字体大小来完成。。。在
结果进入的区域比
^{pr2}$条目小部件无法垂直展开。这是因为已经有一个小部件为此而设计,称为
Text()
。要将文本添加到文本小部件中,我们可以使用insert()
,并使用两部分索引指定位置。第一部分是行,第二部分是列。对于行/行,它从数字1开始,对于该行的索引,它从零开始。在例如,如果您希望在第一行/列插入内容,您应该执行
insert("1.0", "some data here")
。在下面是使用
Text()
代替的代码。在相关问题 更多 >
编程相关推荐