Help! Too much space in a SizedDialog

Hi! I’m working from the “form” version of the wx.SizedControls.SizedDialog from the Demo; here’s my code:

class PackageDlg(sc.SizedDialog):
def init(self, parent, id):
sc.SizedDialog.init(self, None, -1, “Package Dialog”,
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

    pane = self.GetContentsPane()
    pane.SetSizerType("form")
   
    # row 1
    st = wx.StaticText(pane, -1, "Package Name")
    textCtrl = wx.TextCtrl(pane, -1, "")
    textCtrl.SetSizerProps(expand=False)
   
    # row 2
    saveCtrl = filebrowse.DirBrowseButton(pane, -1)
    saveCtrl.SetLabel("Create where?")

    self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
   
    self.Fit()
    self.SetMinSize(self.GetSize())

Here’s a screenshot of the result:

I would like the dialog width to be governed by the second row, with Package Name’s text control right next to it’s label (I don’t really care much about the alignment of the buttons); I’ve tried many things but can’t get that to happen–please help!

Thanks!

OlyDLG

The “DirBrowseButton” is creating the layout problem, as its label,
textctrl and button form one large control.

A work around might be to use a staticText instead of the label.

# row 2:

st = wx.StaticText(pane, -1, "Create where?")

saveCtrl = filebrowse.DirBrowseButton(pane, -1)

saveCtrl.SetLabel("") # not sure this is needed

Werner
···

On 14/03/2012 04:51, OlyDLG wrote:

  Hi!  I'm working from the "form" version of the

wx.SizedControls.SizedDialog from the Demo; here’s my code:

  class PackageDlg(sc.SizedDialog):

      def __init__(self, parent, id):

          sc.SizedDialog.__init__(self, None, -1, "Package Dialog",


                          style=wx.DEFAULT_DIALOG_STYLE |

wx.RESIZE_BORDER)

          pane = self.GetContentsPane()

          pane.SetSizerType("form")

         

          # row 1

          st = wx.StaticText(pane, -1, "Package Name")

          textCtrl = wx.TextCtrl(pane, -1, "")

          textCtrl.SetSizerProps(expand=False)

         

          # row 2

          saveCtrl = filebrowse.DirBrowseButton(pane, -1)

          saveCtrl.SetLabel("Create where?")



          self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK

wx.CANCEL))

          self.Fit()

          self.SetMinSize(self.GetSize())



  Here's a screenshot of the result:

    I

would like the dialog width to be governed by the second row,
with Package Name’s text control right next to it’s label (I
don’t really care much about the alignment of the buttons); I’ve
tried many things but can’t get that to happen–please help!

Thanks, werner, but that's the way I originally had it, and the result
is even worse!

···

On Mar 14, 1:55 am, werner <wbru...@free.fr> wrote:

On 14/03/2012 04:51, OlyDLG wrote:

> Hi! I'm working from the "form" version of the
> wx.SizedControls.SizedDialog from the Demo; here's my code:

> class PackageDlg(sc.SizedDialog):
> def __init__(self, parent, id):
> sc.SizedDialog.__init__(self, None, -1, "Package Dialog",
> style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

> pane = self.GetContentsPane()
> pane.SetSizerType("form")

> # row 1
> st = wx.StaticText(pane, -1, "Package Name")
> textCtrl = wx.TextCtrl(pane, -1, "")
> textCtrl.SetSizerProps(expand=False)

> # row 2
> saveCtrl = filebrowse.DirBrowseButton(pane, -1)
> saveCtrl.SetLabel("Create where?")

> self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK |
> wx.CANCEL))

> self.Fit()
> self.SetMinSize(self.GetSize())

> Here's a screenshot of the result:

> <https://lh5.googleusercontent.com/-eYNjl5YjXn4/T2AT1iIaLlI/AAAAAAAAAA...&gt;

> I would like the dialog width to be governed by the second row, with
> Package Name's text control right next to it's label (I don't really
> care much about the alignment of the buttons); I've tried many things
> but can't get that to happen--please help!

The "DirBrowseButton" is creating the layout problem, as its label,
textctrl and button form one large control.

A work around might be to use a staticText instead of the label.

# row 2:
st = wx.StaticText(pane, -1, "Create where?")
saveCtrl = filebrowse.DirBrowseButton(pane, -1)
saveCtrl.SetLabel("") # not sure this is needed

Werner

But that gives me an idea for a workaround, if necessary: is it
possible to suppress the button of the DirBrowseButton control? Then
I could use that for the first row also and just handle the text
control portion the way I want?

···

On Mar 14, 8:30 am, OlyDLG <eulergaussriem...@gmail.com> wrote:

Thanks, werner, but that's the way I originally had it, and the result
is even worse!

On Mar 14, 1:55 am, werner <wbru...@free.fr> wrote:

> On 14/03/2012 04:51, OlyDLG wrote:

> > Hi! I'm working from the "form" version of the
> > wx.SizedControls.SizedDialog from the Demo; here's my code:

> > class PackageDlg(sc.SizedDialog):
> > def __init__(self, parent, id):
> > sc.SizedDialog.__init__(self, None, -1, "Package Dialog",
> > style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

> > pane = self.GetContentsPane()
> > pane.SetSizerType("form")

> > # row 1
> > st = wx.StaticText(pane, -1, "Package Name")
> > textCtrl = wx.TextCtrl(pane, -1, "")
> > textCtrl.SetSizerProps(expand=False)

> > # row 2
> > saveCtrl = filebrowse.DirBrowseButton(pane, -1)
> > saveCtrl.SetLabel("Create where?")

> > self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK |
> > wx.CANCEL))

> > self.Fit()
> > self.SetMinSize(self.GetSize())

> > Here's a screenshot of the result:

> > <https://lh5.googleusercontent.com/-eYNjl5YjXn4/T2AT1iIaLlI/AAAAAAAAAA...&gt;

> > I would like the dialog width to be governed by the second row, with
> > Package Name's text control right next to it's label (I don't really
> > care much about the alignment of the buttons); I've tried many things
> > but can't get that to happen--please help!

> The "DirBrowseButton" is creating the layout problem, as its label,
> textctrl and button form one large control.

> A work around might be to use a staticText instead of the label.

> # row 2:
> st = wx.StaticText(pane, -1, "Create where?")
> saveCtrl = filebrowse.DirBrowseButton(pane, -1)
> saveCtrl.SetLabel("") # not sure this is needed

> Werner

Try adding the wx.StaticText like Werner suggested, then creating a SizedPanel and adding the DirBrowseButton as a child of it.

Regards,

Kevin

···

On Mar 14, 2012, at 8:52 AM, OlyDLG wrote:

But that gives me an idea for a workaround, if necessary: is it
possible to suppress the button of the DirBrowseButton control? Then
I could use that for the first row also and just handle the text
control portion the way I want?

On Mar 14, 8:30 am, OlyDLG <eulergaussriem...@gmail.com> wrote:

Thanks, werner, but that's the way I originally had it, and the result
is even worse!

On Mar 14, 1:55 am, werner <wbru...@free.fr> wrote:

On 14/03/2012 04:51, OlyDLG wrote:

Hi! I'm working from the "form" version of the
wx.SizedControls.SizedDialog from the Demo; here's my code:

class PackageDlg(sc.SizedDialog):
    def __init__(self, parent, id):
        sc.SizedDialog.__init__(self, None, -1, "Package Dialog",
                        style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        pane = self.GetContentsPane()
        pane.SetSizerType("form")

        # row 1
        st = wx.StaticText(pane, -1, "Package Name")
        textCtrl = wx.TextCtrl(pane, -1, "")
        textCtrl.SetSizerProps(expand=False)

        # row 2
        saveCtrl = filebrowse.DirBrowseButton(pane, -1)
        saveCtrl.SetLabel("Create where?")

        self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK |
wx.CANCEL))

        self.Fit()
        self.SetMinSize(self.GetSize())

Here's a screenshot of the result:

<https://lh5.googleusercontent.com/-eYNjl5YjXn4/T2AT1iIaLlI/AAAAAAAAAA...&gt;

I would like the dialog width to be governed by the second row, with
Package Name's text control right next to it's label (I don't really
care much about the alignment of the buttons); I've tried many things
but can't get that to happen--please help!

The "DirBrowseButton" is creating the layout problem, as its label,
textctrl and button form one large control.

A work around might be to use a staticText instead of the label.

# row 2:
st = wx.StaticText(pane, -1, "Create where?")
saveCtrl = filebrowse.DirBrowseButton(pane, -1)
saveCtrl.SetLabel("") # not sure this is needed

Werner

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Yeap, never used DirBrowseButton and looking at it it seems a big handicapped:-( , i.e. it doesn't give you much control of what happens to this label etc.

So, you have have to hand code it, or provide a patch to make DirBrowseButton.label optional, which isn't really that much code.

See attached, obviously it needs more checking etc etc.

Werner

sizedFormDialog.py (1.56 KB)

···

On 14/03/2012 16:30, OlyDLG wrote:

Thanks, werner, but that's the way I originally had it, and the result
is even worse!

Thanks, Werner, that did the trick! Bruhin is your last name, yes? (I
want to credit you in my code.)

···

On Mar 14, 9:18 am, werner <wbru...@free.fr> wrote:

On 14/03/2012 16:30, OlyDLG wrote:> Thanks, werner, but that's the way I originally had it, and the result
> is even worse!

Yeap, never used DirBrowseButton and looking at it it seems a big
handicapped:-( , i.e. it doesn't give you much control of what happens
to this label etc.

So, you have have to hand code it, or provide a patch to make
DirBrowseButton.label optional, which isn't really that much code.

See attached, obviously it needs more checking etc etc.

Werner

sizedFormDialog.py
1KViewDownload

Thanks, Werner, that did the trick! Bruhin is your last name, yes?

That is correct.

   (I
want to credit you in my code.)

Thanks, but seriously I don't think that was a big suggesting/help needing to be credited. Maybe credit the list in general as there are many many people on here who help out all the time.

Werner

···

On 14/03/2012 22:10, OlyDLG wrote:

Well said Werner!

···

On 15/03/2012 7:33 AM, werner wrote:

On 14/03/2012 22:10, OlyDLG wrote:

Thanks, Werner, that did the trick! Bruhin is your last name, yes?

That is correct.

   (I
want to credit you in my code.)

Thanks, but seriously I don't think that was a big suggesting/help
needing to be credited. Maybe credit the list in general as there are
many many people on here who help out all the time.

Werner

Das ist gut, werde tun!

···

On Thu, Mar 15, 2012 at 1:02 AM, Gadget/Steve GadgetSteve@live.co.uk wrote:

On 15/03/2012 7:33 AM, werner wrote:

On 14/03/2012 22:10, OlyDLG wrote:

Thanks, Werner, that did the trick! Bruhin is your last name, yes?

That is correct.

(I

want to credit you in my code.)

Thanks, but seriously I don’t think that was a big suggesting/help

needing to be credited. Maybe credit the list in general as there are

many many people on here who help out all the time.

Werner

Well said Werner!

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en


Note my address change and please update your address books. Thanks!