please any one tell me what I have to do to get what i write in textctrl to a variable.
from visual import *
import wx
L = 320
w = window(width=2*(L+window.dwidth), height=L+window.dheight+window.menuheight,
menus=True, title='Widgets')
p=w.panel
d = 20
tc = wx.TextCtrl(p, pos=(1.4*L,90),size=(150,90))
yy=GetValue()
GetValue is not working here. Please help.
I think you are trying to get the content of the textctrl named as tc
. In that case this line
yy = GetValue()
in your code should be
yy = tc.GetValue()
I would also recommend you to use some meaningful names for the variables. For an instance instead of yy
use something like textctrlValue
or textctrlContent
or tcValue
or tcContent
, so that you know what this variable is actually for.
You probably mean yy = tc.GetValue()
(last line of your code) which actually gets the value from the wx.TextCtrl
you've created.
Your code will raise a NameError
as it is now.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.