Can select wx.Choice option

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

Can select wx.Choice option

Andy P
Hi all, I have been having trouble storing an option from wx.Choice that was selected by the user.

Bellow is my handler function when a Choice event occurs.

def choice_hdlr(self,event):
#Store profile selected by user
self.sec_3_data = (self.sec_3_widgets[1].GetString(self.sec_3_widgets[1].GetSelection()))
print("In choice hdl: "+self.sec_3_data)#DELET LATER
 
As you can see I have a member variable "self.sec_3_data" in which I want store whatever the user selected from wx.Choice.

But some reason I can get it to store there, I am only able to see the option selected within the handler function, as you see in my print statement.

Any guidance will be great guys.

Thank you.

HAPPY CODING.



--
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: Can select wx.Choice option

Dietmar Schwertberger-2
On 7/10/2018 8:24 AM, Andy P wrote:
> Any guidance will be great guys.

I did not try it, but the fragment that you posted looks OK.
As written in the description of the group, please attach a fully
working code sample file to your post. Then it's much more likely that
you get a solution to your problem.

Regards,

Dietmar


--
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: Can select wx.Choice option

Tim Roberts
In reply to this post by Andy P
On Jul 9, 2018, at 11:24 PM, Andy P <[hidden email]> wrote:

Hi all, I have been having trouble storing an option from wx.Choice that was selected by the user.

Bellow is my handler function when a Choice event occurs.

def choice_hdlr(self,event):
#Store profile selected by user
self.sec_3_data = (self.sec_3_widgets[1].GetString(self.sec_3_widgets[1].GetSelection()))
print("In choice hdl: "+self.sec_3_data)#DELET LATER
 
As you can see I have a member variable "self.sec_3_data" in which I want store whatever the user selected from wx.Choice.

But some reason I can get it to store there, I am only able to see the option selected within the handler function, as you see in my print statement.

I don't understand.  Are you saying that you cannot access self.sec_3_data from other methods after this code has run?  That's impossible.  Are you sure you're trying to access it from the same class that contains choice_hdlr?  Are you sure you're spelling the name properly?
— 
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.
Reply | Threaded
Open this post in threaded view
|

Re: Can select wx.Choice option

Andy P
In reply to this post by Dietmar Schwertberger-2
Hi Dietmar, I actually found a solution to my problem. But I will follow your advice on posting the entire working code for a future question.

Thank you.

On Tue, Jul 10, 2018 at 2:56 PM, Dietmar Schwertberger <[hidden email]> wrote:
On 7/10/2018 8:24 AM, Andy P wrote:
Any guidance will be great guys.

I did not try it, but the fragment that you posted looks OK.
As written in the description of the group, please attach a fully working code sample file to your post. Then it's much more likely that you get a solution to your problem.

Regards,

Dietmar



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



--
________________________________________________________
JAIRO A. PEREZ
(862-888-1757
________________________________________________________

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