Re: [pygtk] Problems with my first pygtk program



On Thu, Apr 10, 2003 at 10:23:25AM -0300, Christian Reis wrote:

Cross-posting since it is a GTK+ question to see if anybody else has a
hint.

On Thu, Apr 10, 2003 at 11:09:19AM +0200, Antoon Pardon wrote:
On Wed, Apr 09, 2003 at 10:04:09AM -0300, Christian Reis wrote:
On Wed, Apr 09, 2003 at 02:13:55PM +0200, Antoon Pardon wrote:

Third problem is that I would like to have fixed sizes
for all the widgets.
          ^^^
(not all, some! :-)

Well in one sense all, in another sense none.

I want the widgets to be fixed, meaning they are independend
of the value shown in them. I don't want them fixed meaning
they can adapt to resizings of the frame.

I am writing a dril program for my daughter so that she can test
and exercise her latin vocabulary. I am using a table 24 rows

Interesting application. Your GtkTable:

+------------+----------------------+-----------------------------------+
| Latin word | Entry 1              | Entry 2                           |
+------------+----------------------+-----------------------------------+
|            | Correction           | Correction                        |
+------------+----------------------+-----------------------------------+


There really isn't a trivial solution (at least in Gtk+ 1.2) that solves
this problem without fixing a widget size.

I'm using pygtk 1.99.16

...

So that is why I think some kind of fixing the sizes of the widgets
is a good idea in this case.

Not a good idea, but perhaps unavoidable. It would be nice to manually
be able to state "this column has 40% of the width, this one has 20%,
the other has 40%". Reminds someone of HTML widths? :-)

Well I think I have solved the problem in a satisfactory way

First of all I made sure the '\n' were removed from the answers I would
show in the correction.

Secondly, while reading the latin file I counted the letters in each
word and answers. I then calculated multipliers to know how much larger
the second and third collum should be in comparrison with the first.
Call them mul2 and mul3.

Thirdly, I then create a tabel with 1 + mul2 + mul3 collums, in which I specify
the collums have to be homogeneous. I then let the entries and correction
labels span the needed number of collums.

Last, before starting the exercise I put in each label a string of X's
that has the length of the the longest possible value for that label.

The result is that the widgets stay the same size during the exercise
but adapt when the frame is resized.

-- 
Antoon Pardon



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]