Setting wxDialog-Position in xrc file...

Hi @all,

i am very new to wxPython and have generated some xrc-Files for visual
Layout.
How do I set the position for the wxDialog-Object?

Code Example:

<object class="wxDialog" name="easyPickPrint">
    <title>Einfacher Picklistendruck</title>
    <!--<style>wxCAPTION | wxMINIMIZE_BOX | wxSYSTEM_MENU</style>-->
    <pos>wxCENTER_ON_SCREEN</pos>
    <size>550,330</size>
    .....

When executing the code appears an error :

'Cannot parse coordinates from 'wxCENTER_ON_SCREEN'

Is this the wrong pos??

Best regards,
Marcus.

mkimpenhaus@plus.de wrote:

Hi @all,

i am very new to wxPython and have generated some xrc-Files for visual Layout.
How do I set the position for the wxDialog-Object?

Code Example:

<object class="wxDialog" name="easyPickPrint">
    <title>Einfacher Picklistendruck</title>
    <!--<style>wxCAPTION | wxMINIMIZE_BOX | wxSYSTEM_MENU</style>-->
    <pos>wxCENTER_ON_SCREEN</pos>
    <size>550,330</size>
    .....

When executing the code appears an error :

'Cannot parse coordinates from 'wxCENTER_ON_SCREEN'

Is this the wrong pos??

Yes. <pos> is expecting two integers just like <size>. If you want to center the dialog you can do it after it has been loaded from the resource by calling its Center method.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

How can i write the information from checkboxes in a file? Program runs
without errors, the file get after running 1kb, but there is nothing in
file...

file_dt=open('name.txt','w')

checkbox=wxCheckBox(self,60,"Name",(400,300))
EVT_CHECKBOX(self,60,self.EvtCheckBox1)
def EvtCheckBox1(self,event):
        print 'Chosen Team Member:', self.choice.GetStringSelection()
        print 'chosen TM:', event.GetString()
        kou=event.GetString()
        file_dt.write(kou)
        file_dt.write('\r\n')

regards,
Stephan

Stephan Huijgen wrote:

How can i write the information from checkboxes in a file? Program runs
without errors, the file get after running 1kb, but there is nothing in
file...

file_dt=open('name.txt','w')

checkbox=wxCheckBox(self,60,"Name",(400,300))
EVT_CHECKBOX(self,60,self.EvtCheckBox1)
def EvtCheckBox1(self,event):
        print 'Chosen Team Member:', self.choice.GetStringSelection()
        print 'chosen TM:', event.GetString()
        kou=event.GetString()
        file_dt.write(kou)
        file_dt.write('\r\n')

GetString is only valid for selection events from a wxListBox or wxChoice control, not for EVT_CHECKBOX.

If you just want to know if the checkbox is checked, you can call event.IsChecked(). If, however, you want to retrieve the label of the checkbox ("Name" in the example above) you need a reference to the wxCheckBox object, so you can call its GetLabel method (inherited from wxControl). You can store a reference in self.mycheckbox (or whatever variable you want) when you create it. Or (in wxPython only, not wxWindows), you can call event.GetEventObject() to retrieve a reference to the checkbox object.

A variety of different EVT_ macros generate wxCommandEvents because they are the only kind of event which will be sent to the parent of the control if the control itself doesn't handle it. However, since the underlying controls are not the same, wxCommandEvent has a lot of methods which don't apply to all events. If you read the wxCommandEvent documentation for each method, it says to which events it applies.

David

IIRC, there is a "centered" property that you can set for this, i.e.:
   <centered>1</centered>
should do the job.

Alberto

···

On Tue, 17 Jun 2003 13:43:11 +0200, mkimpenhau wrote:

Hi @all,

i am very new to wxPython and have generated some xrc-Files for visual
Layout.
How do I set the position for the wxDialog-Object?

Code Example:

<object class="wxDialog" name="easyPickPrint">
    <title>Einfacher Picklistendruck</title>
    <!--<style>wxCAPTION | wxMINIMIZE_BOX | wxSYSTEM_MENU</style>-->
    <pos>wxCENTER_ON_SCREEN</pos>
    <size>550,330</size>
    .....

When executing the code appears an error :

'Cannot parse coordinates from 'wxCENTER_ON_SCREEN'

Is this the wrong pos??