On Thu, 2008-01-24 at 18:14 +0100, Wildemar Wildenburger wrote:
> Hello :)
> 
> I'm trying to create a note-taking application, very much "inspired" by 
> the KDE-app Basket (BasKet, I don't know). I've made a gritty little 
> video of Basket in use, if you don't know it: 
> <URL:www.student.uni-oldenburg.de/andreas.waldenburger/Basket.mpeg> 
> (it's DivX, about 40 seconds and roughly 1MB).
> I have also attached a screenshot and the code of my experimental version.

People already discussed extensively about reusing an existing canvas,
so I won't go into that.

What you have here is code using the Gtk+ layout system as canvas.
There are two schools of thought regarding Gtk+ and canvases:

  A) Some people believe Gtk+ already has most things needed to draw
complex GUIs, and you don't really need a "canvas".  Your little program
is an excellent proof-of-concept of this idea;

  B) Some people think that Gtk+ widget system has too many limitations
and we should have a new canvas widget.  Among the limitations of Gtk+
widget system are: 1. large overhead for creating widgets vs creating
canvas items (e.g. X server round trip times for creating gdk windows,
can have impact if creating thousands of items), 2. does not support
layering of widgets with transparency and alpha channel, 3. does not
properly support rotation/scaling.

> 
> I have several questions now:
> 
> How would I draw the boxes efficiently? When moving the Boxes around, 
> the different borders will unhinge a little (so you can see cracks 
> between them) and I don't want that.

I don't see any cracks, here.  Have you tried running the program under
a compositing manager?

> I have considered drawing the border as a whole and then overlaying the 
> left and right sides with eventboxes to add the current functionality. 
> Is that preferable? What /is/ preferable?
> How can I shape these boxes efficiently? I know that this is answered in 
> the FAQ; I would like to know how to reuse what I have already drawn, as 
> in: "Make this thing transparent, *except* for where I've drawn."

Since gtk+ does not (AFAIR) support alpha compositing at the widget
level, you have to create a gdk.Bitmap and use
gdk.Window.shape_combine_mask().  See the FAQ:

http://faq.pygtk.org/index.py?req=show&file=faq10.024.htp

Hope this helps.

-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
"The universe is always one step beyond logic" -- Frank Herbert

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to