python如何实现多行输入框_Python:Tkinter:多行滚动输入框

我想让一个Tkinter窗口能够要求多行输入

(因此用户将添加一行或多行文本)

然后当我们点击按钮,就可以检索到用户输入的值以供进一步使用。在

到目前为止,我有这样的脚本:from Tkinter import *

import ScrolledText

class EntryDemo:

def __init__(self, rootWin):

#Create a entry and button to put in the root window

self.textfield = ScrolledText(rootWin)

#Add some text:

self.textfield.delete(0,END)

self.textfield.insert(0, "Change this text!")

self.textfield.pack()

self.button = Button(rootWin, text="Click Me!", command=self.clicked)

self.button.pack()

def clicked(self):

print("Button was clicked!")

eText = self.textfield.get()

print("The Entry has the following text in it:", eText)

#Create the main root window, instantiate the object, and run the main loop

rootWin = Tk()

#app = EntryDemo( rootWin )

rootWin.mainloop()

但似乎没用,一扇窗户里空无一物。

你能帮帮我吗?在

#########编辑

新代码:

^{pr2}$

抱歉,如果它看起来像是没有努力的一些落选选民(即使我花了一天多的时间),但多行文字输入并不是我们可以称之为充分记录,我们自己学习。在

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值