import wx
class App(wx.App):
def OnInit(self):
frame=Frame()
frame.Show()
self.SetTopWindow(frame)
return True
class Frame(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,"Frame",size(600,600))
panel=wx.Panel(self)
button=wx.Button(panel,label="ClickMe",pos=(50,50),size=(100,100))
self.bind(wx.EVT_BUTTON, self.username, button)
def username(self,event):
dlg=TextEntryDialog(None,"What is you name","TxtEntryDialog","UserName")
if dlg.ShowModal()=wx.ID_OK:
UserName=dlg.GetValue()
ok, what I am trying to do, is to replace the TextEntryDialog
, with something that does not pop up after a button is clicked, but stays there in the frame, as for example the search bar on google.... is that event possible?
PS there may be bugs in the program...but it is just to give an idea
You want the wx.TextCtrl. It is the go-to widget for entering text. There are a few others, such as StyledText, but I have rarely needed those. If you need a control for searching, you should check out the SearchCtrl widget.
I second @otterb's suggestion of using the wxPython demo. It will help you learn about the vast majority of available widgets.
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.