[pygtk] PyGTK Tutorial in Bahasa Indonesia

2004-01-19 Thread mige
Hi 

Just FYI ... I have a little tutorial (some part is translation) for 
PyGTK in Bahasa Indonesia ...

http://www.geocities.com/mige_harimurti/gtk2python/Tutorial_PyGTK_2_0.html

regards,
mige
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Why the extra layer?

2004-01-19 Thread Antoon Pardon
On Fri, Jan 16, 2004 at 03:33:12PM -0200, Christian Robottom Reis wrote:
 On Fri, Jan 16, 2004 at 04:41:22PM +0100, Antoon Pardon wrote:
  I have just written my first application with a
  gtk.DrawingArea. Can someone explain why I have to
  do anything usefull with it I always have to
  refer to the window attribute.
 
 It probably stems from the fact that the DrawingArea is -- IIRC --
 almost entirely designed to wrap its GdkWindow. IOW, it doesn't have any
 [relevant] methods of its own; it's just designed to allow you to do GDK
 calls without any widget features (which would be pretty undesireable
 for a canvas anyway).

But if that is the purpose, why not use a GdkWinow instead of
the DrawingArea.
 
  Why not
  
DA = gtk.DrawingArea()
...
gc = DA.new_gc()
DA.draw_point(gc , x , y)
  
  instead of
  
DA = gtk.DrawingArea()
...
gc = DA.window.new_gc()
DA.window.draw_point(gc , x , y)
  
  The way it is done now just seems to
  complicate things whithout good
  reason.
 
 Note that it *used* to be (in GTK-1.2 era) just like you suggested --
 the wrapper class for GtkDrawingArea proxied all its calls into its
 GdkWindow. I *think* James changed this because there was no longer a
 Python wrapper class in PyGTK-2.x, and perhaps to keep us as close as
 possible to the GTK+ bindings.
 
 (Haven't I answered this before?)
 
 At any rate, it's trivial to write a wrapper class in Python that
 proxies all calls to the GdkWindow; that is however left as an exercise
 to the reader wink.

It probably is. But it makes the tutorial a bit hard to understand.
Section 12.2 Talk about the drawing methods and introduces them as:

  drawable.draw_point ..., 

With a name as DrawingArea, that strongly suggests it is a drawable.
A newbee can hardlee know that it is not the drawingarea itself that
is a drawable but its window attribute 

In this case I would say that wrapping the methods in the demo adds
to the confusion. That is because the method to handle the expose
events comes first and there you just see area.draw_point, exactly
the same method name of a drawable. This reinforce the idea that
it is the drawing area that is the drawable.

Sure on a closer look one sees what is going on, but that doesn't
change the fact that it is confusing at first sight.

-- 
Antoon Pardon
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Executing commands without callbacks...

2004-01-19 Thread Michel Thadeu
Hi guys!

I am working on a checklist program, it's a simple program, I create a
window with a close button and a treeview... In this treeview I have a
liststore with 2 columns, the first with CellRendererToggle, and
another with CellRendererText...

The problem is that I execute a gtk.main() to put the program in the
mainloop... I need to populate the liststore, but or I populate before
showing all the widgets with gtk.main() or I execute next to the
gtk.main(), in this case the list are populated only when I close the
app...

Is there a way to define a callback when the program shows the app?

thanks for all help and sorry my poor english :)

=
--
Michel Thadeu Sabchuk
Curitiba/PR

__

Yahoo! GeoCities: a maneira mais fácil de criar seu web site grátis!
http://br.geocities.yahoo.com/
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Why the extra layer?

2004-01-19 Thread Christian Robottom Reis
On Mon, Jan 19, 2004 at 09:55:34AM +0100, Antoon Pardon wrote:
 On Fri, Jan 16, 2004 at 03:33:12PM -0200, Christian Robottom Reis wrote:
  On Fri, Jan 16, 2004 at 04:41:22PM +0100, Antoon Pardon wrote:
   I have just written my first application with a
   gtk.DrawingArea. Can someone explain why I have to
   do anything usefull with it I always have to
   refer to the window attribute.
  
  It probably stems from the fact that the DrawingArea is -- IIRC --
  almost entirely designed to wrap its GdkWindow. IOW, it doesn't have any
  [relevant] methods of its own; it's just designed to allow you to do GDK
  calls without any widget features (which would be pretty undesireable
  for a canvas anyway).
 
 But if that is the purpose, why not use a GdkWinow instead of
 the DrawingArea.

AIUI you aren't supposed to use a GdkWindow as a widget (i.e., add it to
other container widgets, connect to signals, etc) -- the bare essentials
that GtkWidget provides are required if you want widget-like access.

IIRC the GtkDrawingArea is the simplest GTK+ widget (because it simply
uses to the GtkWidget foundation to offer access to its GdkWindow).

  Note that it *used* to be (in GTK-1.2 era) just like you suggested --
  the wrapper class for GtkDrawingArea proxied all its calls into its
  GdkWindow. I *think* James changed this because there was no longer a
  Python wrapper class in PyGTK-2.x, and perhaps to keep us as close as
  possible to the GTK+ bindings.
  
  (Haven't I answered this before?)
  
  At any rate, it's trivial to write a wrapper class in Python that
  proxies all calls to the GdkWindow; that is however left as an exercise
  to the reader wink.
 
 It probably is. But it makes the tutorial a bit hard to understand.
 Section 12.2 Talk about the drawing methods and introduces them as:

[snipped comments on low understandability]

You have a good point. I'm not sure what the correct way to avoid this
is -- perhaps the correct thing would be to add a FAQ item for this
issue and point newcomers there. Does that sound like a good solution?
If so, would you like to contribute the FAQ text? :-)

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Executing commands without callbacks...

2004-01-19 Thread Christian Robottom Reis
On Mon, Jan 19, 2004 at 12:48:06PM -0300, Michel Thadeu wrote:
 The problem is that I execute a gtk.main() to put the program in the
 mainloop... I need to populate the liststore, but or I populate before
 showing all the widgets with gtk.main() or I execute next to the
 gtk.main(), in this case the list are populated only when I close the
 app...
 
 Is there a way to define a callback when the program shows the app?

Yes, and there are a couple of different ways to do it. For instance,
you can:

a) Connect to the main window's map or realize signal and
   populate the list there. IIRC that map can be issued multiple
   times, so you'll need to avoid repopulating.

b) Use an idle handler, which runs a function or method during the
   mainloop (gtk.idle_add(func_ref))

There are other ways (`invente a sua'), each with slightly different
semantics. If you have a specific problem, you can ask and we'll try to
solve it.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] about widget creation in libglade

2004-01-19 Thread Christian Robottom Reis
On Sat, Jan 17, 2004 at 04:31:33AM -0800, Sridhar R wrote:
 I think the solution to this problem is libglade
 should have a function that takes already created
 widget (window?) as id and sets the properties on that
 widget, then adding the children that widget.  That
 widget is commonly a gtk.Window.  If libglade has such
 a function them the above example could be written as
 ..
 
 class MyWindowGreat(gtk.Window):
 def __init__(self):
 super(MyWindow, self).__init__()
 self.gladexml = glade.XML('my.glade',
 existing=self)
 wind = self.gladexml.get_widget('main_window')
 print wind is self # This is prints `True`

How would you specify multiple pre-existing widgets? 

Normally I find myself wanting to customize the behaviour of a certain
Glade-created widget, and up to now I have relied on __class__
attribution and signals. It works, but it would be nice to allow
specifying your own handler for specific widgets in glade. Perhaps
something like 

http://bugzilla.gnome.org/show_bug.cgi?id=69639

reports?

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Resize image

2004-01-19 Thread Mauricio Téllez
Hi, I start a little program that need a kind of image galley, so I use
something like that:
 ...
 box = gtk.HBox()
 im =gtk.Image()
 im.set_from_file(my.jpg)
 im.show()
 box.pack_start(im)
 ...

that works fine, except that the image is displayed in his natural way,
and I need to displayed smaller than the actual size. Any suggestion?
Thanks

--
Mauricio Tellez

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Event triggered by combobox

2004-01-19 Thread David Farning
What event is trigger by changing the currently selected combo box item.

Thanks
Dave Farning

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/