Ok, here it is. Thanks for the help really appreciate it. To pass
information from one frame to the next (i.e., from wxFrame1 to
wxDialog1) I use global variables from wxFrame1. So for example if I
want to use a wxFrame1 variable myVar in wxDialog1 then I use
wxFrame1.myVar in wxDialog1. I think this is bad form, I would rather
pass the variables to the wxDialog1. thanks.
Jeff
-----Original Message-----
From: Steve Holden [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 26, 2005 10:00 AM
To: Jeff Peery
Subject: Re: [python-win32] (no subject)
Perhaps you could post the code of your dialog?
I presume
a) It's in a module called wxDialog2, and
b) It starts with
class wxDialog2(wxDialog):
regards
Steve
Jeff Peery wrote:
> Hi thanks Steve, I am a bit new to this python stuff, could you
explain
> your response a bit more? I'm not sure what a subclass is, and the
> _init_() function as I am aware of is simply the function that
executes
> when the dialog is opened... correct? My dialog2 is a dialog that I
call
> from a parent frame called wxFrame1. Thanks.
>
> -----Original Message-----
> From: Steve Holden [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 26, 2005 9:18 AM
> To: Jeff Peery
> Cc: [email protected]
> Subject: Re: [python-win32] (no subject)
>
> Jeff Peery wrote:
>
>
>>Hello, I am using wxpython and I am having trouble passing variables
>>from one frame to another. If I have a parent frame - frame1 - and I
>>call a dialog using the following text:
>>
>>
>>
>> dlg = wxDialog2.wxDialog2(self)
>>
>> try:
>>
>> dlg.ShowModal()
>>
>> finally:
>>
>> dlg.Destroy()
>>
>>
>>
>>where in this bit of code would I pass a variable to the new dialog? I
>
>
>>tried several things but I can't seem to get it to work. Thanks!
>>
>>
>
>
> If wxDialog2 is a subclass of wxDialog then it can have __init__()
> arguments that don't get passed to wxDialog's __init__() call, but are
> instead used (and possibly stored) by the instance's extension of
> __init__().
>
> Does this answer your question?
>
> regards
> Steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
#Boa:Dialog:wxDialog2
from wxPython.wx import *
from os import *
from Numeric import *
from cStringIO import *
from string import *
from fileinput import *
from re import *
import wxFrame1
def create(parent):
return wxDialog2(parent)
[wxID_WXDIALOG2, wxID_WXDIALOG2CANCEL, wxID_WXDIALOG2FINDK,
wxID_WXDIALOG2STATICBOX1, wxID_WXDIALOG2STATICTEXT1,
wxID_WXDIALOG2STATICTEXT10, wxID_WXDIALOG2STATICTEXT2,
wxID_WXDIALOG2STATICTEXT3, wxID_WXDIALOG2STATICTEXT4,
wxID_WXDIALOG2STATICTEXT5, wxID_WXDIALOG2STATICTEXT6,
wxID_WXDIALOG2STATICTEXT7, wxID_WXDIALOG2STATICTEXT8,
wxID_WXDIALOG2STATICTEXT9, wxID_WXDIALOG2TEXTCTRL3, wxID_WXDIALOG2TEXTCTRL5,
wxID_WXDIALOG2WINDOW1,
] = map(lambda _init_ctrls: wxNewId(), range(17))
class wxDialog2(wxDialog):
#Variables
parent = wxDialog #holds the parent frame pointer
interDiam = 0 #holds the internal diameter
extDiam = 0 #holds the external diameter
wallThickness = 0 #holds the wall thickness
haveInterDiam = wxFrame1.FALSE #gets True if the user inputs a
acceptable number or two other values are known
haveWallThickness = wxFrame1.FALSE #gets True if the user inputs a
acceptable number or two other values are known
haveExtDiam = wxFrame1.FALSE #gets True if the user inputs a
acceptable number or two other values are known
def _init_utils(self):
# generated method, don't edit
pass
def _init_ctrls(self, prnt):
# generated method, don't edit
wxDialog.__init__(self, id=wxID_WXDIALOG2, name='wxDialog2',
parent=prnt, pos=wxPoint(367, 276), size=wxSize(271, 259),
style=wxDEFAULT_DIALOG_STYLE, title='Approximate Dimensions')
self._init_utils()
self.SetClientSize(wxSize(263, 232))
self.window1 = wxWindow(id=wxID_WXDIALOG2WINDOW1, name='window1',
parent=self, pos=wxPoint(0, 0), size=wxSize(263, 232), style=0)
self.staticBox1 = wxStaticBox(id=wxID_WXDIALOG2STATICBOX1,
label='Pipe Dimensions', name='staticBox1', parent=self.window1,
pos=wxPoint(8, 8), size=wxSize(248, 104), style=0)
self.FindK = wxButton(id=wxID_WXDIALOG2FINDK, label='Execute',
name='FindK', parent=self.window1, pos=wxPoint(8, 192),
size=wxSize(128, 32), style=0)
self.FindK.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, False,
'MS Shell Dlg'))
self.FindK.SetForegroundColour(wxColour(200, 0, 0))
EVT_BUTTON(self.FindK, wxID_WXDIALOG2FINDK, self.OnFindkButton)
self.Cancel = wxButton(id=wxID_WXDIALOG2CANCEL, label='Cancel',
name='Cancel', parent=self.window1, pos=wxPoint(144, 192),
size=wxSize(112, 32), style=0)
EVT_BUTTON(self.Cancel, wxID_WXDIALOG2CANCEL, self.OnCancelButton)
self.staticText1 = wxStaticText(id=wxID_WXDIALOG2STATICTEXT1,
label='K-factor:', name='staticText1', parent=self.window1,
pos=wxPoint(24, 160), size=wxSize(48, 16), style=wxALIGN_RIGHT)
self.staticText1.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, False,
'MS Shell Dlg'))
self.staticText3 = wxStaticText(id=wxID_WXDIALOG2STATICTEXT3,
label='Dimension D:', name='staticText3', parent=self.window1,
pos=wxPoint(24, 128), size=wxSize(92, 16), style=wxALIGN_RIGHT)
self.staticText3.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, False,
'MS Shell Dlg'))
self.staticText4 = wxStaticText(id=wxID_WXDIALOG2STATICTEXT4,
label='Wall Thickness:', name='staticText4', parent=self.window1,
pos=wxPoint(24, 80), size=wxSize(95, 16), style=wxALIGN_RIGHT)
self.staticText4.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, False,
'MS Shell Dlg'))
self.textCtrl3 = wxTextCtrl(id=wxID_WXDIALOG2TEXTCTRL3,
name='textCtrl3', parent=self.window1, pos=wxPoint(128, 32),
size=wxSize(64, 24), style=0, value='')
self.textCtrl3.SetToolTipString('')
EVT_TEXT(self.textCtrl3, wxID_WXDIALOG2TEXTCTRL3, self.OnTextctrl3Text)
self.textCtrl5 = wxTextCtrl(id=wxID_WXDIALOG2TEXTCTRL5,
name='textCtrl5', parent=self.window1, pos=wxPoint(128, 72),
size=wxSize(64, 24), style=0, value='')
EVT_TEXT(self.textCtrl5, wxID_WXDIALOG2TEXTCTRL5, self.OnTextctrl5Text)
self.staticText5 = wxStaticText(id=wxID_WXDIALOG2STATICTEXT5,
label='Ext. Diameter:', name='staticText5', parent=self.window1,
pos=wxPoint(24, 40), size=wxSize(82, 16), style=wxALIGN_RIGHT)
self.staticText5.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, False,
'MS Shell Dlg'))
self.staticText9 = wxStaticText(id=wxID_WXDIALOG2STATICTEXT9,
label='(NA)', name='staticText9', parent=self.window1,
pos=wxPoint(200, 128), size=wxSize(21, 13), style=0)
self.staticText9.SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, False,
'MS Shell Dlg'))
self.staticText6 = wxStaticText(id=wxID_WXDIALOG2STATICTEXT6,
label='(NA)', name='staticText6', parent=self.window1,
pos=wxPoint(200, 160), size=wxSize(21, 13), style=0)
self.staticText6.SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, False,
'MS Shell Dlg'))
self.staticText8 = wxStaticText(id=wxID_WXDIALOG2STATICTEXT8,
label='(NA)', name='staticText8', parent=self.window1,
pos=wxPoint(200, 40), size=wxSize(21, 13), style=0)
self.staticText10 = wxStaticText(id=wxID_WXDIALOG2STATICTEXT10,
label='(NA)', name='staticText10', parent=self.window1,
pos=wxPoint(200, 80), size=wxSize(21, 13), style=0)
self.staticText2 = wxStaticText(id=wxID_WXDIALOG2STATICTEXT2, label='',
name='staticText2', parent=self.window1, pos=wxPoint(128, 128),
size=wxSize(0, 13), style=0)
self.staticText7 = wxStaticText(id=wxID_WXDIALOG2STATICTEXT7, label='',
name='staticText7', parent=self.window1, pos=wxPoint(128, 160),
size=wxSize(0, 13), style=0)
def __init__(self, parent):
self._init_ctrls(parent)
#assign the pointer to frame1 to the global variable 'parent'
wxDialog2.parent = parent
#set the unit labels on 'K' and 'insertion depth' to the appropriate
dimensions
if parent.unitType == 'BRITISH':
self.staticText6.SetLabel('(pulses/gal)')
self.staticText9.SetLabel('(in)')
self.staticText8.SetLabel('(in)')
self.staticText10.SetLabel('(in)')
if parent.unitType == 'SI':
self.staticText6.SetLabel('(pulses/m^3)')
self.staticText9.SetLabel('(m)')
self.staticText8.SetLabel('(m)')
self.staticText10.SetLabel('(m)')
def OnCancelButton(self, event):
#Reset variables
wxDialog2.haveInterDiam = wxFrame1.FALSE #gets True if the user
inputs a acceptable number or two other values are known
wxDialog2.haveWallThickness = wxFrame1.FALSE #gets True if the user
inputs a acceptable number or two other values are known
wxDialog2.haveExtDiam = wxFrame1.FALSE #gets True if the user
inputs a acceptable number or two other values are known
self.Close()
def OnFindkButton(self, event):
#---------------------------------------------------------
#Get dimentions
#Internal Diameter
#wxDialog2.interDiam = self.textCtrl2.GetValue()
#Wall thickness
wxDialog2.wallThickness = self.textCtrl5.GetValue()
#Get the external diameter
wxDialog2.extDiam = self.textCtrl3.GetValue()
#---------------------------------------------------------
#Determine what two dimensions are given and calculate the third
## try:
## isGoodNum = float(wxDialog2.interDiam)/2
## wxDialog2.haveInterDiam = wxFrame1.TRUE
## wxDialog2.interDiam = float(wxDialog2.interDiam)
## except:
wxDialog2.haveInterDiam = wxFrame1.FALSE
try:
isGoodNum = float(wxDialog2.wallThickness)/2
wxDialog2.wallThickness = float(wxDialog2.wallThickness)
wxDialog2.haveWallThickness = wxFrame1.TRUE
except:
wxDialog2.haveWallThickness = wxFrame1.FALSE
try:
isGoodNum = float(wxDialog2.extDiam)/2
wxDialog2.extDiam = float(wxDialog2.extDiam)
wxDialog2.haveExtDiam = wxFrame1.TRUE
except:
wxDialog2.haveExtDiam = wxFrame1.FALSE
#Get and fill in the third dimension if any two of the three
#dimensions are specified
if wxDialog2.haveInterDiam and wxDialog2.haveExtDiam:
wxDialog2.wallThickness = (wxDialog2.extDiam -
wxDialog2.interDiam)/2
#self.textCtrl5.SetValue(('%5.4f' % wxDialog2.wallThickness))
elif wxDialog2.haveInterDiam and wxDialog2.haveWallThickness:
wxDialog2.extDiam = wxDialog2.interDiam +
2*wxDialog2.wallThickness
#self.textCtrl3.SetValue(('%5.4f' % wxDialog2.extDiam))
#fill in the external diam or internal diameter if the appropriate
#text fields are filled in
elif wxDialog2.haveWallThickness and wxDialog2.haveExtDiam:
wxDialog2.interDiam = wxDialog2.extDiam -
2*wxDialog2.wallThickness
#self.textCtrl2.SetValue(('%5.4f' % wxDialog2.interDiam))
elif wxDialog2.haveInterDiam and wxDialog2.haveWallThickness:
wxDialog2.extDiam = wxDialog2.interDiam +
2*wxDialog2.wallThickness
#self.textCtrl3.SetValue(('%5.4f' % wxDialog2.extDiam))
#fill in the wall thickness or internal diameter if the appropriate
#text fields are filled in
elif wxDialog2.haveInterDiam and wxDialog2.haveExtDiam:
wxDialog2.wallThickness = (wxDialog2.extDiam -
wxDialog2.interDiam)/2
#self.textCtrl5.SetValue(('%5.4f' % wxDialog2.wallThickness))
elif wxDialog2.haveExtDiam and wxDialog2.haveWallThickness:
wxDialog2.interDiam = wxDialog2.extDiam -
2*wxDialog2.wallThickness
#self.textCtrl2.SetValue(('%5.4f' % wxDialog2.interDiam))
else:
dlg = wxMessageDialog(self, 'Internal Error',
'Caption', wxOK | wxICON_INFORMATION)
try:
dlg.ShowModal()
finally:
dlg.Destroy()
#---------------------------------------------------------
#Determine if conversion of meter height is needed
if wxDialog2.parent.unitType == 'BRITISH':
conversion = 1.0
elif wxDialog2.parent.unitType == 'SI':
conversion = wxFrame1.IN_TO_M
#---------------------------------------------------------
#Determine insertion depth; using 12% internal diameter
try:
if wxDialog2.parent.meterType == wxFrame1.TYPE_EX81:
insertionDepth = FALSE
elif wxDialog2.parent.meterType == wxFrame1.TYPE_EX82:
insertionDepth = FALSE
elif wxDialog2.parent.meterType == wxFrame1.TYPE_EX101:
insertionDepth = wxFrame1.HEIGHT_EX101*conversion -
wxDialog2.wallThickness - (wxFrame1.PERC_INS_DEPTH/100.0)*wxDialog2.interDiam
elif wxDialog2.parent.meterType == wxFrame1.TYPE_EX115:
insertionDepth = wxFrame1.HEIGHT_EX115*conversion -
wxDialog2.wallThickness - (wxFrame1.PERC_INS_DEPTH/100.0)*wxDialog2.interDiam
elif wxDialog2.parent.meterType == wxFrame1.TYPE_EX201:
insertionDepth = wxFrame1.HEIGHT_EX201*conversion -
wxDialog2.wallThickness - (wxFrame1.PERC_INS_DEPTH/100.0)*wxDialog2.interDiam
elif wxDialog2.parent.meterType == wxFrame1.TYPE_EX215:
insertionDepth = wxFrame1.HEIGHT_EX215*conversion -
wxDialog2.wallThickness - (wxFrame1.PERC_INS_DEPTH/100.0)*wxDialog2.interDiam
except:
dlg = wxMessageDialog(self, 'One or more dimensions are not valid
numbers',
'Caption', wxOK | wxICON_INFORMATION)
try:
dlg.ShowModal()
finally:
dlg.Destroy()
#---------------------------------------------------------
#Determine if conversion of volume is needed
if wxDialog2.parent.unitType == 'BRITISH':
conversion2 = 1.0
conversion1 = 1.0
elif wxDialog2.parent.unitType == 'SI':
conversion2 = wxFrame1.G_TO_M_CUBED
conversion1 = wxFrame1.IN_TO_M
#---------------------------------------------------------
#POWER FIT
try:
k = exp(wxFrame1.A2 * log(wxDialog2.interDiam/conversion1) +
wxFrame1.B2)*conversion2
#k2 is used for interpolating outside the bounds of empicial data
k2 = (conversion2*(wxFrame1.A +
wxFrame1.B*(wxDialog2.interDiam/conversion1) +
wxFrame1.C*(wxDialog2.interDiam/conversion1)**2 +
wxFrame1.D*(wxDialog2.interDiam/conversion1)**3 +
wxFrame1.E*(wxDialog2.interDiam/conversion1)**4))
#Set the insertion depth in the appropriate text field
self.staticText2.SetLabel(('%5.2f' % insertionDepth))
#check that the input diameter is within the operating range
if wxDialog2.interDiam > (2.7*conversion1) and wxDialog2.interDiam
< (70*conversion1):
#Set the k value in the appropriate text field
if wxDialog2.interDiam <= 8.065*conversion1:
self.staticText7.SetLabel(('%5.2f' % k2))
elif wxDialog2.interDiam < 70*conversion1:
self.staticText7.SetLabel(('%5.2f' % k))
else:
dlg = wxMessageDialog(self, 'Internal diameter must be less
than 50(in) or 1270(mm) \nand greater than 2.7(in) or 68.5(mm)',
'Caption', wxOK | wxICON_INFORMATION)
try:
dlg.ShowModal()
finally:
dlg.Destroy()
except:
dlg = wxMessageDialog(self, 'One or more dimensions are not valid
numbers',
'Caption', wxOK | wxICON_INFORMATION)
try:
dlg.ShowModal()
finally:
dlg.Destroy()
def OnTextctrl3Text(self, event):
pass
def OnTextctrl5Text(self, event):
pass
def OnTextctrl2Text(self, event):
pass
#Boa:Frame:wxFrame1
from wxPython.wx import *
from wxPython.lib.anchors import LayoutAnchors
from wxPython.lib.buttons import *
import wxDialog2
from os import *
from Numeric import *
from cStringIO import *
from string import *
from fileinput import *
from re import *
#Globals
#for regions inside the bounds of empirical data
A = 3.641277972845E+002
B = -1.591675040373E+002
C = 2.581145417181E+001
D = -1.711266756664E+000
E = 3.532598870248E-002
# for regions out of bounds of empirical data this fit is used for interpolating
A2 = -2.000000003185E+000
B2 = 6.580587941746E+000
#BOOLEAN FALSE
FALSE = 0
#BOOLEAN TRUE
TRUE = 1
#THIS NUMBER STORES THE TYPE OF INSERTION METER SPECIFIED BY THE USER
#UNDER THE "METER IDENTIFICATION" SECTION OF THE PARENT DIALOG. THIS
#IDENTIFICATION IS USED TO IDENTIFY THE "INSERTION DEPTH" OF THE PARTICULAR
#METER. INSERTION DEPTH IS DEFINED AS THE DEPTH FROM THE TOP OF THE LOWER
#HOUSING FLANGE TO THE FIRST STEP OF THE ELECTRODE CAP. THE FIRST STEP IS THE
#LEVEL BELOW THE TIP (SECOND STEP), THE TIP HAS ONE ELECTRODE THE FIRST STEP
#HAS TWO.
#
#MODEL TYPE EX81
TYPE_EX81 = 'TYPE_EX81'
#MODEL TYPE EX81
TYPE_EX82 = 'TYPE_EX82'
#MODEL TYPE EX101
TYPE_EX101 = 'TYPE_EX101'
#MODEL TYPE EX101
TYPE_EX115 = 'TYPE_EX115'
#MODEL TYPE EX101
TYPE_EX201 = 'TYPE_EX201'
#MODEL TYPE EX101
TYPE_EX215 = 'TYPE_EX215'
#CONVERSION UNITS (METERS PER IN); 0.0254 meters per in; reference
www.onlineconversion.com
IN_TO_M = 0.0254
#CONVERSION UNITS (METERS PER IN); 0.0254 meters per in; reference
www.onlineconversion.com
#IN_TO_MM = 0.0254*1000.0
#CONVERSION UNITS (METER CUBED PER GALLON; 1 cubic meter = 264.1720512 gallon
[US, liquid]; ref www.onlineconversion.com
G_TO_M_CUBED = 264.1720512
#CONVERSION UNITS (METER CUBED PER GALLON; 1 gallon [US, liquid] = 3,785,411.8
cubic millimeter; ref www.onlineconversion.com
#G_TO_MM_CUBED = 1.0/3785411.8
#MODEL HEIGHT (in); there is not a good reference for these values
HEIGHT_EX101 = 10.396
HEIGHT_EX201 = 15.396
HEIGHT_EX115 = 17.396
HEIGHT_EX215 = 21.396
#Insertion Depth, currently using 12%
#this was determined from "Flow Measurement," Spitzer
#plotting eq. 22-2
PERC_INS_DEPTH = 11.75
def create(parent):
return wxFrame1(parent)
[wxID_WXFRAME1, wxID_WXFRAME1BUTTON2, wxID_WXFRAME1CANCEL,
wxID_WXFRAME1RADIOBOX1, wxID_WXFRAME1RADIOBOX2, wxID_WXFRAME1WINDOW1,
] = map(lambda _init_ctrls: wxNewId(), range(6))
class wxFrame1(wxFrame):
#Variables
meterType = TYPE_EX101 #Holds the Meter Type selected, default to ex101
unitType = 'BRITISH' #Holds 'BRITISH' or 'SI' unit type selected;
default to british units
def _init_utils(self):
# generated method, don't edit
self.icon = wxIcon('horse.ico', wxBITMAP_TYPE_ICO)
self.SetIcon(self.icon)
pass
def _init_ctrls(self, prnt):
# generated method, don't edit
wxFrame.__init__(self, id=wxID_WXFRAME1, name='', parent=prnt,
pos=wxPoint(338, 303), size=wxSize(240, 220),
style=wxDEFAULT_FRAME_STYLE | wxCAPTION, title='EX SeaKalc')
self._init_utils()
self.SetClientSize(wxSize(240, 220))
self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, False,
'@Arial Unicode MS'))
self.Enable(True)
self.SetAutoLayout(True)
self.Show(True)
self.window1 = wxWindow(id=wxID_WXFRAME1WINDOW1, name='window1',
parent=self, pos=wxPoint(0, 0), size=wxSize(240, 220), style=0)
self.button2 = wxButton(id=wxID_WXFRAME1BUTTON2,
label='Calculate K and Insertion Depth', name='button2',
parent=self.window1, pos=wxPoint(8, 152), size=wxSize(225, 28),
style=0)
self.button2.SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, False,
'MS Shell Dlg'))
self.button2.SetForegroundColour(wxColour(250, 0, 0))
EVT_BUTTON(self.button2, wxID_WXFRAME1BUTTON2, self.OnButton2Button)
self.Cancel = wxButton(id=wxID_WXFRAME1CANCEL, label='Cancel',
name='Cancel', parent=self.window1, pos=wxPoint(8, 184),
size=wxSize(225, 28), style=0)
EVT_BUTTON(self.Cancel, wxID_WXFRAME1CANCEL, self.OnCancelButton)
self.radioBox1 = wxRadioBox(choices=['EX81 ', 'EX82 ', 'EX101 ',
'EX115 ', 'EX201 ', 'EX215 '], id=wxID_WXFRAME1RADIOBOX1,
label='Meter Type', majorDimension=3, name='radioBox1',
parent=self.window1, point=wxPoint(8, 8), size=wxSize(225, 64),
style=0, validator=wxDefaultValidator)
self.radioBox1.SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, False,
'MS Shell Dlg'))
self.radioBox1.Enable(True)
self.radioBox1.Show(True)
self.radioBox1.SetSelection(2)
EVT_RADIOBOX(self.radioBox1, wxID_WXFRAME1RADIOBOX1,
self.OnRadiobox1Radiobox)
self.radioBox2 = wxRadioBox(choices=['meter/cubic meter',
'inches/gallon'],
id=wxID_WXFRAME1RADIOBOX2, label='Unit Type', majorDimension=2,
name='radioBox2', parent=self.window1, point=wxPoint(8, 80),
size=wxSize(225, 64), style=wxRA_SPECIFY_COLS,
validator=wxDefaultValidator)
self.radioBox2.Show(True)
self.radioBox2.SetSelection(1)
EVT_RADIOBOX(self.radioBox2, wxID_WXFRAME1RADIOBOX2,
self.OnRadiobox2Radiobox)
def __init__(self, parent):
self._init_ctrls(parent)
def OnButton2Button(self, event):
dlg = wxDialog2.wxDialog2(self)
try:
dlg.ShowModal()
finally:
dlg.Destroy()
def OnCancelButton(self, event):
self.Close()
def OnRadiobox1Radiobox(self, event):
#get the selected meter
dummy = self.radioBox1.GetSelection()
if dummy == 0:
wxFrame1.meterType = TYPE_EX81
if dummy == 1:
wxFrame1.meterType = TYPE_EX82
if dummy == 2:
wxFrame1.meterType = TYPE_EX101
if dummy == 3:
wxFrame1.meterType = TYPE_EX115
if dummy == 4:
wxFrame1.meterType = TYPE_EX201
if dummy == 5:
wxFrame1.meterType = TYPE_EX215
def OnRadiobox2Radiobox(self, event):
#get the selected unit
dummy = self.radioBox2.GetSelection()
if dummy == 1:
wxFrame1.unitType = 'BRITISH'
elif dummy == 0:
wxFrame1.unitType = 'SI'
#!/usr/bin/env python
#Boa:App:BoaApp
#-------------------------------------------------------
# Version 1.0.0
# by Jeff Peery July 15, 2004
#-------------------------------------------------------
#
# Add revisions here (number, description, date, initials
#________________________
#
# 1) initial release, 07/15/2004, JTP
#
from wxPython.wx import *
import wxFrame1
from os import *
from Numeric import *
from cStringIO import *
from string import *
from fileinput import *
from re import *
modules ={'wxDialog1': [0, '', 'wxDialog1.py'],
'wxFrame1': [1, 'Main frame of Application', 'wxFrame1.py']}
class BoaApp(wxApp):
def OnInit(self):
wxInitAllImageHandlers()
self.main = wxFrame1.create(None)
# needed when running from Boa under Windows 9X
self.SetTopWindow(self.main)
self.main.Show();self.main.Hide();self.main.Show()
return True
def main():
application = BoaApp(0)
application.MainLoop()
if __name__ == '__main__':
main()
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32