473,320 Members | 2,117 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

wxpython question

Hi,
I am new to python and also new to wxpython. I have a problem with radio button. I created 2 radiobutton and then a ok button. How can I write a code so that when I click a first radiobutton and then click a ok button, the message related to first radiobutton should open. Same way when I click the 2nd radiobutton and click ok button, a message related to 2nd radiobutton should open. Right now the message is just a print statement.

Please help!!

Thanks
May 23 '07 #1
2 1427
bartonc
6,596 Expert 4TB
Hi,
I am new to python and also new to wxpython. I have a problem with radio button. I created 2 radiobutton and then a ok button. How can I write a code so that when I click a first radiobutton and then click a ok button, the message related to first radiobutton should open. Same way when I click the 2nd radiobutton and click ok button, a message related to 2nd radiobutton should open. Right now the message is just a print statement.

Please help!!

Thanks
We can help, but you'll need to post some code to show what you are working on.

On the right hand side of the page (while you are replying with a copy of your script in the clipboard), you'll find POSTING GUIDELINES which tell you how to use [code] tags so that we'll be able to see the structure of your code.

Thanks for joining.
May 24 '07 #2
We can help, but you'll need to post some code to show what you are working on.

On the right hand side of the page (while you are replying with a copy of your script in the clipboard), you'll find POSTING GUIDELINES which tell you how to use [code] tags so that we'll be able to see the structure of your code.

Thanks for joining.
Thanks.The following is the code I am trying to implement.
Expand|Select|Wrap|Line Numbers
  1. import wx
  2. import os, sys
  3. import string
  4.  
  5. class MyFrame(wx.Frame):
  6.         def __init__(self, parent, id, title):
  7.             wx.Frame.__init__(self, parent,-1,title,wx.DefaultPosition,wx.Size(402,450))
  8.  
  9.             self.mainpa = wx.Panel(self,-1,wx.DefaultPosition, wx.DefaultSize)
  10.             self.stext1 = wx.StaticText(self.mainpa,-1,"Select Type",(20,10))
  11.  
  12.             self.rb1 = wx.RadioButton(self.mainpa,40,"Title1",wx.Point(20,60))
  13.             self.Bind(wx.EVT_RADIOBUTTON,self.OnSelect,id =40)
  14.  
  15.             self.rb2 = wx.RadioButton(self.mainpa,50,"Title2",wx.Point(20,80))
  16.             self.Bind(wx.EVT_RADIOBUTTON,self.OnSelect,id=50)
  17.  
  18.  
  19.             self.b1 =wx.Button(self.mainpa,30,'Ok',(300,340))
  20.             self.Bind(wx.EVT_BUTTON,self.OnSelect,id = 30)
  21.  
  22.        def OnSelect(self,event):
  23.             if (self.board.GetId()):
  24.                     print 'Title1 selected'
  25.             if(self.chassis.GetId()):
  26.                     print 'Title2 Selected'
I think my OnSelect function is not correct, thats where I need help. I want to select Title1 and click Ok button and the print statement must be 'Title1 Selected'. Samething for the 'Title2'

Thanks
Sumitha
May 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Equis Uno | last post by:
Hi, I'm trying to run some Python software I downloaded off of sf.net. It's called Boa. It uses wxPython. It appears my install of Python cannot see my install of wxPython.
8
by: Erik Johnson | last post by:
I am looking for some input on GUI libraries. I want to build a Python-driven GUI, but don't really understand the playing field very well. I have generally heard good things about wxPython. I...
4
by: KvS | last post by:
Hi all, I'm pretty new to (wx)Python so plz. don't shoot me if I've missed something obvious ;). I have a panel inside a frame, on which a Button and a StaticText is placed: self.panel =...
1
by: Steven W. Orr | last post by:
python-2.3.5 wx-2.6 I just bought the wxPython In Action book and I see that all the examples say to import wx All of our pre-existing code was horribly doing a from wxPython import * I...
0
by: gooli | last post by:
The best thing I've found until now is XRCed. It has it's quirks and pitfalls, but it fits the bill. Personally I prefer the previous version (the one that comes with wxPython 2.8.6) and don't...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.