OGL: resizing shapes to fit the text

Hi all,

I have added the line

     shape.SetFormatMode(ogl.FORMAT_SIZE_TO_CONTENTS)

to MyAddShape() in the OGL.py demo program to check if
the shapes can resize themselves to fit the text inserted, but
it seems not working at the moment; the unique thing that changes is that
the text inside the shapes is not more centered but it shifts near to the
top/left corner
(I'm running 2.5.2.8 under linux mandrake 9.2)

Might also be that I need to do some other changes in the code but the
documentation I found is not useful to understand WHAT, this is the reason
because I'm writing.

I looked in this mailing list archive before writing, but it seems there is no
so much people yet working with OGL ( I'm feeling alone :frowning: )

Thanks
Macs

giuseppe massimo bertani wrote:

I looked in this mailing list archive before writing, but it seems there is no so much people yet working with OGL ( I'm feeling alone :frowning: )

OGL is old, and not actively maintained anymore.
Therefore you might want to take a look at:

Here you can do all those things an more.

Regards,

Klaas

Sorry wrong list respons, wxart2D is not for wxPython ( yet or never ).

klaas.holwerda wrote:

···

Here you can do all those things an more.

giuseppe massimo bertani wrote:

Hi all,

I have added the line

     shape.SetFormatMode(ogl.FORMAT_SIZE_TO_CONTENTS)

to MyAddShape() in the OGL.py demo program to check if the shapes can resize themselves to fit the text inserted, but
it seems not working at the moment; the unique thing that changes is that
the text inside the shapes is not more centered but it shifts near to the top/left corner
(I'm running 2.5.2.8 under linux mandrake 9.2)

Might also be that I need to do some other changes in the code but the documentation I found is not useful to understand WHAT, this is the reason because I'm writing.
I looked in this mailing list archive before writing, but it seems there is no so much people yet working with OGL ( I'm feeling alone :frowning: )

That is both true and false. The C++ version of OGL seems to be almost completely unused and unmaintained, but since there are a number of wxPython users who are using it the code was recently ported to Python so that wxPython users can more easily track down bugs like this and find a solution. Take a look at FormatText() in wx/lib/ogl/_basic.py and see if you can find a fix.

···

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

Alle 22:57, martedì 7 settembre 2004, Robin Dunn ha scritto:

giuseppe massimo bertani wrote:
> Hi all,
>
> I have added the line
>
> shape.SetFormatMode(ogl.FORMAT_SIZE_TO_CONTENTS)
>
> to MyAddShape() in the OGL.py demo program to check if
> the shapes can resize themselves to fit the text inserted, but
> it seems not working at the moment; the unique thing that changes is that
> the text inside the shapes is not more centered but it shifts near to the
> top/left corner
> (I'm running 2.5.2.8 under linux mandrake 9.2)
>
> Might also be that I need to do some other changes in the code but the
> documentation I found is not useful to understand WHAT, this is the
> reason because I'm writing.
>
> I looked in this mailing list archive before writing, but it seems there
> is no so much people yet working with OGL ( I'm feeling alone :frowning: )

That is both true and false. The C++ version of OGL seems to be almost
completely unused and unmaintained, but since there are a number of
wxPython users who are using it the code was recently ported to Python
so that wxPython users can more easily track down bugs like this and
find a solution. Take a look at FormatText() in wx/lib/ogl/_basic.py
and see if you can find a fix.

Thank you Robin, I simply wanted to be sure that it is a OGL bug before
putting my hands on the OGL code :wink:

Massimo

Alle 22:57, martedì 7 settembre 2004, Robin Dunn ha scritto:
> giuseppe massimo bertani wrote:
> > Hi all,
> >
> > I have added the line
> >
> > shape.SetFormatMode(ogl.FORMAT_SIZE_TO_CONTENTS)
> >
> > to MyAddShape() in the OGL.py demo program to check if
> > the shapes can resize themselves to fit the text inserted, but
> > it seems not working at the moment; the unique thing that changes is
> > that the text inside the shapes is not more centered but it shifts near
> > to the top/left corner
> > (I'm running 2.5.2.8 under linux mandrake 9.2)
> >
> > Might also be that I need to do some other changes in the code but the
> > documentation I found is not useful to understand WHAT, this is the
> > reason because I'm writing.
> >
> > I looked in this mailing list archive before writing, but it seems
> > there is no so much people yet working with OGL ( I'm feeling alone :frowning:
> > )
>
> That is both true and false. The C++ version of OGL seems to be almost
> completely unused and unmaintained, but since there are a number of
> wxPython users who are using it the code was recently ported to Python
> so that wxPython users can more easily track down bugs like this and
> find a solution. Take a look at FormatText() in wx/lib/ogl/_basic.py
> and see if you can find a fix.

Ok, fixed. I made the following changes:

_basic.py, line 524 becomes:
  len(region.GetFormattedText()) and \

_oglmisc.py, line 156 becomes:
  current_width, char_height = dc.GetTextExtent(line.GetText())

Cheers
Giuseppe Massimo Bertani

giuseppe massimo bertani wrote:

Ok, fixed. I made the following changes:

_basic.py, line 524 becomes:
  len(region.GetFormattedText()) and \

_oglmisc.py, line 156 becomes:
  current_width, char_height = dc.GetTextExtent(line.GetText())

Thanks!

···

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