On button click open wxpython TextEntryDialog and get multiple input from user

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

On button click open wxpython TextEntryDialog and get multiple input from user

himanshu
 0
down vote
favorite
       

I want to open a TextEntryDialog, when user clicks the button. So if i have a button in the parent frame which i am going to bind this way:

      self.Bind(wx.EVT_BUTTON, self.OnAddNew, self.add_new_btn)

Now i have to open a TextEntryDialog when user clicks the button add_new. I want to make textentrydialog somewthing like this
https://stackoverflow.com/questions/42796950/python-using-wxpython-to-get-multiple-input-from-user/42807355#42807355

How can i do that? Do i need to just paste that code in
 def OnAddNew(self, event):
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On button click open wxpython TextEntryDialog and get multiple input from user

Tim Roberts
himanshu wrote:

> I want to open a TextEntryDialog, when user clicks the button. So if i have
> a button in the parent frame which i am going to bind this way:
>
>       self.Bind(wx.EVT_BUTTON, self.OnAddNew, self.add_new_btn)
>
> Now i have to open a TextEntryDialog when user clicks the button add_new. I
> want to make textentrydialog somewthing like this
> https://stackoverflow.com/questions/42796950/python-using-wxpython-to-get-multiple-input-from-user/42807355#42807355
>
> How can i do that? Do i need to just paste that code in
>  def OnAddNew(self, event):

There is a wx.TextEntryDialog already built it, which can ask for a
single line of text.  You can see its use in the demos.

    def onAddNew( self, event ):
        dlg = wx.TextEntryDialog( self, "What do you need?, "Question?" )
        if dlg.ShowModal() == wx.ID_OK:
            print dlg.GetValue()
        dlg.Destroy()

If you want to use the GetData dialog from that link, you just need to
include the "class GetData" definition in your code, then use the code
as they show it:

    def onAddNew( self, event ):
        dlg = GetData( self )
        if dlg.result_name:
            print dlg.result_name
        dlg.Destroy()

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...