TayLayout

Hi Folks,

I've been working on a light GUI helper library for
IronPython/Winforms (boo hiss etc!)
TayLayout is a more sophisticated version of the flow layout. Items
are added in a L to R fashion until you specify that a new line is
required. Demonstrated on my blog are the convenience functions for
creating and adding a control to a container in one step.
http://www.latedecember.co.uk/sites/personal/davy/arch_IronPython.html

My simple query is, would it be worth writing a wxPython version of Taylayout?

Thanks,
Davy

···

--
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Mood News
- BBC News Headlines Auto-Classified as Good, Bad or Neutral.
http://www.latedecember.co.uk/sites/moodnews/

Davy Mitchell wrote:

My simple query is, would it be worth writing a wxPython version of Taylayout?

Yes. Some kind of "flow" Sizer has been asked for numerous times.

One question:

Items are added in a L to R fashion until you specify that a new line
is required.

How do you specify that? In fact, if you need to specify it, then you might as well use one of the grid sizers. I'd rather see the newline calculated according to how much space there is available.

From your blog, in which I don't see the line breaks specified:

    def __init__(self):
         Form.__init__(self)
         self.ALayout = TayLayout()
         self.ALayout.parent = self

         self.textbox = self.ALayout.addNewTextBox("The Default Text",True,150,0)
         self.label = self.ALayout.addNewLabel("StarGate")
         self.piccy = self.ALayout.addNewPictureBox("title.gif", True, 244, 88)
         self.button1 = self.ALayout.addNewButton("Press Me")
         self.button2 = self.ALayout.addNewCheckBox("Some option")
         self.button3 = self.ALayout.addNewButton("OK", False)
         self.button4 = self.ALayout.addNewButton("Cancel", False)
         self.button5 = self.ALayout.addNewButton("Apply", False)

         # Finally set the size of the Form.
         self.ALayout.Complete()

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Christopher Barker wrote:

Davy Mitchell wrote:

My simple query is, would it be worth writing a wxPython version of Taylayout?

Yes. Some kind of "flow" Sizer has been asked for numerous times.

And I think one or two have been posted to this list in the past.

···

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

Thanks for the feedback - very useful.

Christopher wrote:

How do you specify that? In fact, if you need to specify it, then you
might as well use one of the grid sizers.

Set second parameter to True (default) for a new line, False to keep
on current line. (N.B. I am considering using constants or named
parameters here).

The quoted example is a little old. I've posted a tutorial at
http://latedecember.co.uk/sites/personal/davy/
which has a longer explanation.

I'd rather see the newline calculated according to how much
space there is available.

Taylayout works a bit differently, the form or container size is set
based on the size of the controls. That said, there is also a stretch
feature which expands a control to the container width.

A fixed size container version would be handy too. As long as a new
line could be forced if required. Thanks for the idea :slight_smile:

···

On 2/13/07, Robin Dunn <robin@alldunn.com> wrote:

And I think one or two have been posted to this list in the past.

Thanks for that Robin - I'll check the archives.

Davy

--
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Mood News
- BBC News Headlines Auto-Classified as Good, Bad or Neutral.
http://www.latedecember.co.uk/sites/moodnews/

Davy Mitchell wrote:

Taylayout works a bit differently, the form or container size is set
based on the size of the controls.

Now I get it. Yes, I actually could use that on a project right now.

A fixed size container version would be handy too. As long as a new
line could be forced if required. Thanks for the idea :slight_smile:

yes, having either option would be good.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Well with a bit of deleting and replacing DotNet methods, I managed to
get taylayout running for wxpython. No helper functions yet but the
(tiny) core is there.

Maybe put something up on Google tomorrow night :slight_smile:

Couldn't find flowlayout for wxPython. Anyone know where it is? Gmame
turned up little.

Cheers,
Davy

···

On 2/13/07, Christopher Barker <Chris.Barker@noaa.gov> wrote:

Now I get it. Yes, I actually could use that on a project right now.

--
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Mood News
- BBC News Headlines Auto-Classified as Good, Bad or Neutral.
http://www.latedecember.co.uk/sites/moodnews/

Hi Davy,

> Now I get it. Yes, I actually could use that on a project right now.

Well with a bit of deleting and replacing DotNet methods, I managed to
get taylayout running for wxpython. No helper functions yet but the
(tiny) core is there.

Maybe put something up on Google tomorrow night :slight_smile:

Couldn't find flowlayout for wxPython. Anyone know where it is? Gmame
turned up little.

FlowLayout was originally coded by Peter Damoc. I have a working copy
of it on my pc at work, so if you are interested I can re-post it here
tomorrow. Or if Peter wants to do it himself, it would be better, as
he is its original "father" :smiley:
I tried to finish it (as far as I remember, there were some methods
missing), but Peter is far more good at programming than I am, and
actually I don't remember where I left it. If there is interest on it,
I believe we should resurrect FlowLayout and see if we can merge
things with your implementation (or share useful code).

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

···

On 2/13/07, Davy Mitchell wrote:

On 2/13/07, Christopher Barker wrote:

It's quite hard to make a FlowLayout work well, especially if you want to make it reasonably fast.

Instead I've created a panel that does its Layout on its own without sizers. Seems to work quite well so far.

http://www.gooli.org/blog/snippets/

Davy Mitchell wrote:

···

On 2/13/07, Christopher Barker <Chris.Barker@noaa.gov> wrote:

Now I get it. Yes, I actually could use that on a project right now.

Well with a bit of deleting and replacing DotNet methods, I managed to
get taylayout running for wxpython. No helper functions yet but the
(tiny) core is there.

Maybe put something up on Google tomorrow night :slight_smile:

Couldn't find flowlayout for wxPython. Anyone know where it is? Gmame
turned up little.

Cheers,
Davy

the original discussion is here:
http://thread.gmane.org/gmane.comp.python.wxpython/30067

Unfortunately I never got to finish that sizer (my ADD got me)…
Attached is what I think it is the latest version I have.
I would love it if some kind soul would add the missing bits (quote form Robin):
Some things I would like to see added to it are support for

alignment of the items within the space they are given using the
alignment flags, support for items with border space, and perhaps some

sort of support for the wx.EXPAND flag. Oh, and also a docstring! :wink:

The entire code is like 70 lines… out of this 70, the first 10 are comments :wink:

It is no big deal… but I seam to have failed adding another line to that code for 10 months… :wink:

Peter

flowsizer.py (3.11 KB)

···

On 2/14/07, Andrea Gavana andrea.gavana@gmail.com wrote:

Hi Davy,

On 2/13/07, Davy Mitchell wrote:

On 2/13/07, Christopher Barker wrote:

Now I get it. Yes, I actually could use that on a project right now.

Well with a bit of deleting and replacing DotNet methods, I managed to

get taylayout running for wxpython. No helper functions yet but the
(tiny) core is there.

Maybe put something up on Google tomorrow night :slight_smile:

Couldn’t find flowlayout for wxPython. Anyone know where it is? Gmame

turned up little.

FlowLayout was originally coded by Peter Damoc. I have a working copy
of it on my pc at work, so if you are interested I can re-post it here
tomorrow. Or if Peter wants to do it himself, it would be better, as

he is its original “father” :smiley:
I tried to finish it (as far as I remember, there were some methods
missing), but Peter is far more good at programming than I am, and
actually I don’t remember where I left it. If there is interest on it,

I believe we should resurrect FlowLayout and see if we can merge
things with your implementation (or share useful code).

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”

http://xoomer.virgilio.it/infinity77/


To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org


There is NO FATE, we are the creators.

Thanks guys - flowsizer looks interesting. Cool demo :slight_smile:

I worked on wxTayLayout tonight and put together a sample program.
  http://code.google.com/p/taylayout/downloads/list
There's some catch up todo with the IronPython version but only really
in the helper methods and classes. Controls can be right-aligned and
stretched. Button and StaticText have helpers but any control can be
added using 'add'.

Cheers,
Davy Mitchell

Blog - http://www.latedecember.co.uk/sites/personal/davy/
Mood News
- BBC News Headlines Auto-Classified as Good, Bad or Neutral.
http://www.latedecember.co.uk/sites/moodnews/