wx.Choice(): assign selected string directly

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

wx.Choice(): assign selected string directly

Rich Shepard
   Running 4.0.1. Reading the API, my understanding of the wx.Choice() method
GetString(self, n) requires an integer from GetSelection(self). Is there
a way to directly assign the selected string to a variable? For example,

typeList = ['A', 'B', 'C', 'D', 'E']
self.ch = GetString(GetSelection(wxChoice(self, -1, choices=typeList)))

   I'm trying to build a helper function that holds strings from non-text
widgets such as wx.Choice() and wx.SpinCtrlDouble(). I would like to pass
the label and widget string to this function for insertion in the backend
database.

Rich

--
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.
Reply | Threaded
Open this post in threaded view
|

Re: wx.Choice(): assign selected string directly

Matthew Newville
Try Get/SetStringSelection().


On Wed, May 16, 2018, 17:21 Rich Shepard <[hidden email]> wrote:
   Running 4.0.1. Reading the API, my understanding of the wx.Choice() method
GetString(self, n) requires an integer from GetSelection(self). Is there
a way to directly assign the selected string to a variable? For example,

typeList = ['A', 'B', 'C', 'D', 'E']
self.ch = GetString(GetSelection(wxChoice(self, -1, choices=typeList)))

   I'm trying to build a helper function that holds strings from non-text
widgets such as wx.Choice() and wx.SpinCtrlDouble(). I would like to pass
the label and widget string to this function for insertion in the backend
database.

Rich

--
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.

On May 16, 2018 17:21, "Rich Shepard" <[hidden email]> wrote:
   Running 4.0.1. Reading the API, my understanding of the wx.Choice() method
GetString(self, n) requires an integer from GetSelection(self). Is there
a way to directly assign the selected string to a variable? For example,

typeList = ['A', 'B', 'C', 'D', 'E']
self.ch = GetString(GetSelection(wxChoice(self, -1, choices=typeList)))

   I'm trying to build a helper function that holds strings from non-text
widgets such as wx.Choice() and wx.SpinCtrlDouble(). I would like to pass
the label and widget string to this function for insertion in the backend
database.


Rich

--
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.

--
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.
Reply | Threaded
Open this post in threaded view
|

Re: wx.Choice(): assign selected string directly

Rich Shepard
On Wed, 16 May 2018, Matthew Newville wrote:

> Try Get/SetStringSelection().

Matthew,

   I'll try Get and see how that works. I don't know when each of the various
methods is used most appropriately.

Thanks,

Rich

--
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.