From: Steve C. <stn...@xm...> - 2004-09-02 06:01:45
|
It seems like if you set the size of a RadioGroup to something other than -1,-1, the items in the radio group disappear... To reproduce it, I can do the following: * bring up the resource editor * create a RadioGroup Component * Change the size of the RadioGroup to 100,100. press update * Add an item to the RadioGroup ['one','two']. press update The radio buttons stay in place, but the item labels next to the buttons disappear. If I select the radio group in the resource editor window, they re-appear. If I add another item to the list (['one','two','three']) and press update, the item labels disappear again. If I do the same set of steps, but omit the size change, everything is happy. my system: mandrake linux 10.0 python 2.3.3 wxPython 2.5.2.8 PythonCard 0.8 -Steve |
From: Steve C. <stn...@xm...> - 2004-09-03 03:29:34
|
I wrote: > It seems like if you set the size of a RadioGroup to something other > than -1,-1, the items in the radio group disappear... > > > To reproduce it, I can do the following: > * bring up the resource editor > * create a RadioGroup Component > * Change the size of the RadioGroup to 100,100. press update > * Add an item to the RadioGroup ['one','two']. press update > > The radio buttons stay in place, but the item labels next to the buttons > disappear. > > If I select the radio group in the resource editor window, they > re-appear. > > If I add another item to the list (['one','two','three']) and press > update, the item labels disappear again. > > > If I do the same set of steps, but omit the size change, everything is > happy. > > > my system: > mandrake linux 10.0 > python 2.3.3 > wxPython 2.5.2.8 > PythonCard 0.8 > It looks like there's some additional weirdness on Windows XP... If I open up the ResourceEditor, create a RadioGroup, then fiddle with the size or layout of the group, both the buttons and the labels disappear. If I move the mouse over the radio group, the radio buttons re-appear. In the redemo and spirograph demo, the RadioGroup widgets look just fine (on both Linux and XP) -Steve |
From: <gre...@co...> - 2004-09-03 18:40:37
|
Hi, I'm looking at the dbrowser sample. On my computer this is the file: C:\Python23\Lib\site-packages\PythonCard\samples\dbBrowser\dbBrowser.py So this thing when running seems to know the number of columns in any table I connect to and then (creates?) that many text boxes to show the values of each column. Does anyone know how this would work? How are the text boxes created on the fly like that? I was unable to locate any documentation on this this and I can't see how it does it from the code. Thanks, Greg |
From: Alex T. <al...@tw...> - 2004-09-03 19:03:28
|
At 14:42 03/09/2004 -0400, Gregory Pi=F1ero wrote: >Hi, > >I'm looking at the dbrowser sample. On my computer this is the file:=20 >C:\Python23\Lib\site-packages\PythonCard\samples\dbBrowser\dbBrowser.py > >So this thing when running seems to know the number of columns in any=20 >table I connect to and then (creates?) that many text boxes to show the=20 >values of each column. Does anyone know how this would work? How are the= =20 >text boxes created on the fly like that? > >I was unable to locate any documentation on this this and I can't see how= =20 >it does it from the code. It does it in on_btnBrowse_mouseClick, in dbBrowser.py It's the "not for the faint-hearted" code around lines 114-128 that do the= =20 actual creation on the fly .... but I am living proof that you can=20 copy/cut/paste this and do similar things in your own code without=20 understanding them :-) -- Alex. >Thanks, > >Greg > > > >------------------------------------------------------- >This SF.Net email is sponsored by BEA Weblogic Workshop >FREE Java Enterprise J2EE developer tools! >Get your free copy of BEA WebLogic Workshop 8.1 today. >http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick >_______________________________________________ >Pythoncard-users mailing list >Pyt...@li... >https://lists.sourceforge.net/lists/listinfo/pythoncard-users > > > > >--- >Incoming mail is certified Virus Free. >Checked by AVG anti-virus system (http://www.grisoft.com). >Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004 |
From: Kevin A. <al...@se...> - 2004-09-03 20:45:58
|
On Sep 3, 2004, at 11:42 AM, Gregory Pi=F1ero wrote: > Hi, > > I'm looking at the dbrowser sample. On my computer this is the file: =20= > C:\Python23\Lib\site-=20 > packages\PythonCard\samples\dbBrowser\dbBrowser.py > > So this thing when running seems to know the number of columns in any =20= > table I connect to and then (creates?) that many text boxes to show =20= > the values of each column. Does anyone know how this would work? How = =20 > are the text boxes created on the fly like that? > > I was unable to locate any documentation on this this and I can't see =20= > how it does it from the code. > > Thanks, > > Greg Creating components on the fly is easy, you just need to provide a =20 dictionary of the key:value pairs. Just look at the dictionaries for =20 each component in any .rsrc.py file and you'll see the same kind of =20 dictionary in use. For example, to create a button named 'btn1' in your =20= code you might do something like: self.components['btn1'] =3D {'type':'Button', 'name':'btn1', =20 'position':(0, 30), 'label':'btn1 hello'} So, let's say you want to dynamically create 10 single-line fields when =20= your application starts up. Here's one way you might do it: def on_initialize(self, event): insetFromEdge =3D 5 padding =3D 4 self.components['field0'] =3D {'type':'TextField', =20 'name':'field0', 'position':(5, 5), 'text':'field0'} height =3D self.components.field0.size[1] for i in range(1,10): name =3D 'field' + str(i) position =3D (insetFromEdge, insetFromEdge + i * (height + =20= padding)) text =3D name self.components[name] =3D {'type':'TextField', 'name':name, = =20 'position':position, 'text':text} I'm creating the first TextField outside the loop so that I can get the =20= height of a TextField dynamically, which allows the code to work =20 regardless of the default text height on any given platform. You could =20= just as easily, initialize the height to 0 and do an if block after the =20= self.components[name] line to set the height. ka= |
From: <gre...@co...> - 2004-09-03 22:48:01
|
Thanks for the help on the dbBrowser sample. I see how to create widgets at runtime now. I just have one more question for today. I am looking at the dbrowser2 sample now which on my computer is: C:\Python23\Lib\site-packages\PythonCard\samples\dbBrowser\dbBrowser2.py (note: there may be a bug in dbTable.py as I had to do a global replace of "wxPyGridTableBase" to "PyGridTableBase" before it would run.) This program uses a grid to show a table. But I don't believe that a grid is a pycard widget? The author seems to be using wx.grid.PyGridTableBase. My general questions are where can I find out what events can come from this grid and how do I bind actions to the events? Specifically all I want to do is launch a new window when the user clicks on a row in the grid. I'm not sure if my question is clear here, so let me know if you need any other details. Thanks, Greg Kevin Altis wrote: > On Sep 3, 2004, at 11:42 AM, Gregory Piñero wrote: > >> Hi, >> >> I'm looking at the dbrowser sample. On my computer this is the file: >> C:\Python23\Lib\site- packages\PythonCard\samples\dbBrowser\dbBrowser.py >> >> So this thing when running seems to know the number of columns in any >> table I connect to and then (creates?) that many text boxes to show >> the values of each column. Does anyone know how this would work? >> How are the text boxes created on the fly like that? >> >> I was unable to locate any documentation on this this and I can't see >> how it does it from the code. >> >> Thanks, >> >> Greg > > > Creating components on the fly is easy, you just need to provide a > dictionary of the key:value pairs. Just look at the dictionaries for > each component in any .rsrc.py file and you'll see the same kind of > dictionary in use. For example, to create a button named 'btn1' in your > code you might do something like: > > self.components['btn1'] = {'type':'Button', 'name':'btn1', > 'position':(0, 30), 'label':'btn1 hello'} > > So, let's say you want to dynamically create 10 single-line fields when > your application starts up. Here's one way you might do it: > > def on_initialize(self, event): > insetFromEdge = 5 > padding = 4 > self.components['field0'] = {'type':'TextField', > 'name':'field0', 'position':(5, 5), 'text':'field0'} > height = self.components.field0.size[1] > for i in range(1,10): > name = 'field' + str(i) > position = (insetFromEdge, insetFromEdge + i * (height + > padding)) > text = name > self.components[name] = {'type':'TextField', 'name':name, > 'position':position, 'text':text} > > I'm creating the first TextField outside the loop so that I can get the > height of a TextField dynamically, which allows the code to work > regardless of the default text height on any given platform. You could > just as easily, initialize the height to 0 and do an if block after the > self.components[name] line to set the height. > > ka > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_idP47&alloc_id808&op=click > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users > |
From: Alex T. <al...@tw...> - 2004-09-04 01:46:44
|
At 18:49 03/09/2004 -0400, Gregory Pi=F1ero wrote: >Thanks for the help on the dbBrowser sample. I see how to create widgets= =20 >at runtime now. I just have one more question for today. > >I am looking at the dbrowser2 sample now which on my computer is: >C:\Python23\Lib\site-packages\PythonCard\samples\dbBrowser\dbBrowser2.py >(note: there may be a bug in dbTable.py as I had to do a global replace of= =20 >"wxPyGridTableBase" to "PyGridTableBase" before it would run.) > >This program uses a grid to show a table. But I don't believe that a grid= =20 >is a pycard widget? The author seems to be using=20 >wx.grid.PyGridTableBase. My general questions are where can I find out=20 >what events can come from this grid and how do I bind actions to the=20 >events? Specifically all I want to do is launch a new window when the=20 >user clicks on a row in the grid. That's right - PythonCard doesn't (yet) have a grid widget, but this=20 example demonstrates the benefit of being able to "reach-through" to all=20 the wxPython widgets. You should be able to get an idea of the events etc. for any widget from=20 the wxWindows documentation - in this case wxGrid. Or - take a look at samples/simpleGrid - (included in the distribution, but= =20 not available through the sample launcher), which shows how to bind and=20 handle each event type for a grid. (Sorry - I haven't looked at it much myself yet, so I can't answer the=20 specific question). -- Alex. |
From: <gre...@co...> - 2004-09-04 03:24:21
|
Thanks for the advice, Alex, the simplegrid program is very helpful. There may be a bug in the simplegrid program, is it better to report it here, or somehow get a sourceforge login deal and go that route? The bug is in the file: C:\Python23\Lib\site-packages\PythonCard\samples\simpleGrid\simpleGrid.py The program does not work properly unless I do a global replace of event.skip() to event.Skip(). Just lower case s to upper case. I'm not sure why that would be? Here's the version info: PythonCard version: 0.8 wxPython version: 2.5.2.7 Python version: 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] Platform: win32 -Greg Alex Tweedly wrote: > At 18:49 03/09/2004 -0400, Gregory Piñero wrote: > >> Thanks for the help on the dbBrowser sample. I see how to create >> widgets at runtime now. I just have one more question for today. >> >> I am looking at the dbrowser2 sample now which on my computer is: >> C:\Python23\Lib\site-packages\PythonCard\samples\dbBrowser\dbBrowser2.py >> (note: there may be a bug in dbTable.py as I had to do a global >> replace of "wxPyGridTableBase" to "PyGridTableBase" before it would run.) >> >> This program uses a grid to show a table. But I don't believe that a >> grid is a pycard widget? The author seems to be using >> wx.grid.PyGridTableBase. My general questions are where can I find >> out what events can come from this grid and how do I bind actions to >> the events? Specifically all I want to do is launch a new window when >> the user clicks on a row in the grid. > > > That's right - PythonCard doesn't (yet) have a grid widget, but this > example demonstrates the benefit of being able to "reach-through" to all > the wxPython widgets. > > You should be able to get an idea of the events etc. for any widget from > the wxWindows documentation - in this case wxGrid. > > Or - take a look at samples/simpleGrid - (included in the distribution, > but not available through the sample launcher), which shows how to bind > and handle each event type for a grid. > > (Sorry - I haven't looked at it much myself yet, so I can't answer the > specific question). > -- Alex. > |
From: Kevin A. <al...@se...> - 2004-09-04 04:01:00
|
On Sep 3, 2004, at 8:24 PM, Gregory Pi=F1ero wrote: > Thanks for the advice, Alex, the simplegrid program is very helpful. > > There may be a bug in the simplegrid program, is it better to report =20= > it here, or somehow get a sourceforge login deal and go that route? > > The bug is in the file: > C:\Python23\Lib\site-=20 > packages\PythonCard\samples\simpleGrid\simpleGrid.py > > The program does not work properly unless I do a global replace of =20 > event.skip() to event.Skip(). Just lower case s to upper case. I'm =20= > not sure why that would be? > Good catch. I did a global replace on most of the files when I changed =20= to mixedCase style PythonCard method names. In general, event.skip() is =20= used everywhere for consistency, even though event.Skip() is still =20 valid since PythonCard is simply "decorating" the raw wxPython events =20= with some helper attributes and providing method aliases. But in the case of that sample, the events are bound manually and don't =20= use the PythonCard event binding and dispatch, so the manually bound =20 events aren't decorated and the skip alias is missing. I went ahead =20 fixed the problem and checked the change into cvs. Now that components are much simpler to create I plan to update the =20 Grid component so that all the events are bound just like the =20 MultiColumnList and Tree components. I'll update the sample and notify =20= the list when that is done. For now, you can continue to do things like =20= the sample. ka= |