James Carroll wrote:
the visible length. What is this dimension called, and how does one
change it after the control has already been instantiated? There is no
SetSize()
Hi Sandip,
Do you know that you don't want to use sizers?
Typically, you would set the wxExpand flag so that it expands to fit
the controls around it. Try loading the attached xrc file with XRCed.
I've also put that in the top cell of a vertical box sizer, and put a
growing spacer (with option 1) below it so the text control doesn't
get too tall.
Hi Jim!
Yes that work for your example. I didnt know about the wxExpand.
However, take a look at the following exercise that I am doing. I am
using a GridSizer to make the columns look more consistent. However the
textctrl isnt expanding, even with the wxExpand flag. What am i doing wrong?
- Sandip
The code I am using is:
from wxPython.wx import *
from wxPython.xrc import *
class MyApp(wxApp):
def OnInit(self):
self.res = wxXmlResource("fahandcel.xrc")
self.frame = self.res.LoadFrame(None,"frame_main")
self.panel = XRCCTRL(self.frame,"panel_main")
self.ecel = XRCCTRL(self.panel,"e_cel")
self.efah = XRCCTRL(self.panel,"e_fah")
EVT_TEXT_ENTER(self.frame, XRCID("e_cel"), self.EnterVal)
EVT_TEXT_ENTER(self.frame, XRCID("e_fah"), self.EnterVal)
self.mb = self.res.LoadMenuBar("menu_main")
EVT_MENU(self.frame, XRCID("menu_quit"), self.ShutDown)
self.frame.SetMenuBar(self.mb)
self.frame.Show(True)
return True
def EnterVal(self,event):
tofah = False
if event.GetEventObject() == self.ecel:
tofah = True
try:
reading = float(event.GetEventObject().GetValue())
if tofah:
self.efah.SetValue(str(reading * 9/5.0+32))
else:
self.ecel.SetValue(str((reading-32) * 5/9.0))
except ValueError:
event.GetEventObject().SetValue("Invalid entry")
event.GetEventObject().SetSelection(-1,-1)
def ShutDown(self,event):
self.frame.Destroy()
MyApp().MainLoop()
fahandcel.xrc (1.41 KB)
···
--
Sandip Bhattacharya * Puroga Technologies * sandip@puroga.com
Work: http://www.puroga.com * Home/Blog: http://www.sandipb.net/blog
PGP/GPG Signature: 51A4 6C57 4BC6 8C82 6A65 AE78 B1A1 2280 A129 0FF3