[pygtk] [pygnome] gnome2 applets

2003-03-30 Thread Guillaume
Hi all,

I try to do a panel applet for gnome2 in python with pygnome2, but i
don't find any help or tutorial on the web, have ou got any goods url ?
Else i don't know how put for example a label and a button in one
applet, it doesn't work, i have just the label who is displayed

Thank you very much for your help

Guillaume

___
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] putting more than one button in a MessageDialog

2003-03-30 Thread Michael JasonSmith
On Sat, 2003-03-29 at 09:38, florian wrote:
> i have two questions about the MessageDialog class:
> 
> 1) how can i add more than one button to a message
> dialog?
If you want a standard set of buttons (Yes/No, Ok/Cancel...) then use
one of the constants defined in ButtonsType:
http://makeashorterlink.com/?K1C832604 [gnome.org]
(Remember to replace the "GTK_" with "gtk." :) )

Otherwise, 
"If none of these choices are appropriate, simply use 
 GTK_BUTTONS_NONE then call gtk_dialog_add_buttons()."

> 2) how can i connect signals to the buttons?
You connect to the "response" signal of the MessageDialog, rather than
to the "clicked" signal of the buttons.
-- 
Michael JasonSmith  http://www.cosc.canterbury.ac.nz/~mpj17/

___
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] putting more than one button in a MessageDialog

2003-03-30 Thread florian

hi!

i have two questions about the MessageDialog class:

1) how can i add more than one button to a message
dialog? so far i've only seen example with one
button and passing them in a tuple also didnt work..

2) how can i connect signals to the buttons?

thanks alot!

ciao!
florian

___
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] Adjusting a TreeView padding to the other elements ofan HBox

2003-03-30 Thread John Finlay


Grzegorz Adam Hankiewicz wrote:

On 2003-02-23, Grzegorz Adam Hankiewicz <[EMAIL PROTECTED]> wrote:
 

I have a VBox which contains a few buttons and a TreeView. For
the buttons I call set_border_width(), but this doesn't have any
effect on the TreeView.
   

I'm attaching an example which demonstrates this, built up from John
Finlay's tutorial and pygtk's demo (for the TreeView part). The
expected behaviour of the example is to display a button and a
list with three items with the same spacing, but the border of the
TreeView stays invariable. Is this a bug? Is this a feature?
 

Looks like a feature :-)

Maybe the changes suggested below might give you the look you want.

I'm using Python 2.2.1 and PyGTK from CVS.
 



#!/usr/bin/env python

import gtk, gobject

class Test_window:

  def clicked_button1(self, widget):
 print "Button pressed"
  def delete_event(self, widget, event, data = None):
 return 0
  def __init__(self):
 # create the new window
 self.window = window = gtk.Window(gtk.WINDOW_TOPLEVEL)
 window.set_title("Welcome window")
 window.set_border_width(10)
 # delete handler to exit GTK
 window.connect("delete_event", self.delete_event)
 window.connect('destroy', lambda w: gtk.main_quit())
 # create a box to package interface elements inside
 self.box1 = box1 = gtk.VBox(0, 0)
 window.add(box1)
 # create a button
 self.button1 = button1 = gtk.Button("Create")
 box1.pack_start(button1, 1, 1, 0)
box1.pack_start(button1, 1, 1, 5) # adds 5 pixel padding to the top and bottom only

 button1.connect("clicked", self.clicked_button1)
 button1.set_border_width(5)
button1.set_border_width(0) # or remove this line

 button1.show()

 # create a list
 store = gtk.ListStore(gobject.TYPE_STRING)
 for entry in ["One item", "Anoter", "Oh, and this one"]:
store.set(store.append(), 0, entry)
 self.list = list = gtk.TreeView(store)
 box1.pack_start(list)
 # the following line seems to be ignored
 list.set_border_width(50)
# remove the above line

 list.set_rules_hint(1)
 list.set_headers_visible(0)
 column = gtk.TreeViewColumn('Description',
gtk.CellRendererText(), text=0)
 list.append_column(column)
 list.show()
 # show elements
 box1.show()
 window.show()
 
if __name__ == '__main__':
  Test_window = Test_window()
  gtk.main()
 



___
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] code generation from *.glade files

2003-03-30 Thread alea miras
Hello list members,

it seems as if using libglade is the preferred way to deal with Glade's XML output by 
many PyGTK users. I however would like to be able to get Python source code as it is 
possible for C or C++. Is there any up to date utility that is capable of doing this? 
I am talking about the GTK+-2.x related bindings not the older ones.

Thanks for your replies!

Regards,
Alea Miras

-- 
What is the name given to a young bear? 
Find out at postmaster.co.uk

http://www.postmaster.co.uk/cgi-bin/meme/quiz.pl?id=215
___
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] Re: Python & GDK || Suggestions

2003-03-30 Thread Dave Reed
On Sunday 30 March 2003 12:30, Metnetsky wrote:
> On Sun, 2003-03-30 at 04:27, Thomas Speck wrote:
> > On Sun, 2003-03-30 at 08:40, Metnetsky wrote:
> > > I can't seem to find any good documentation/examples on GDK with
> > > Python.  I'm not trying to do much, just open an image, shrink, 
and save
> > > under a new name.  Simply put, I have a few hundred photos that 
need to
> > > be cut in half by exactly 50%.  The program doesn't need an 
interface,
> > > it should be run from a command prompt with a directory path 
passed as
> > > an argument.  All images in the path are loaded and converted.  
Any
> > > suggestions on where/how to begin this?
> > > 
> > > ~ Matthew
> > 
> > I think what you are looking for is gtk.gdk.Pixbuf. As a starting 
point
> > 
> > import gtk
> > pixbuf = gtk.gdk.pixbuf_new_from_file( 'file' )
> > scaled = pixbuf.scale_simple( pixbuf.get_width()/2,
> >  pixbuf.get_height()/2, gtk.gdk.INTERP_BILINEAR )
> > scaled.save( 'scaled.png', 'png' )
> > 
> > The documenation on this topic isn't the best but maybe you should 
look
> > here:
> > http://www.gnome.org/~james/pygtk-docs/class-gdkpixbuf.html
> > 
> > Thomas
> > 
> Thanks for the tip.
> 
> I tried the above code and some variations on the theme but the Python
> interpreter keeps returning "AttributeError: 'gtk.gdk.Pixbuf' object 
has
> no attribute 'save'".  Any suggestions?  I looked through the
> documentation, but it definitely lacks something to be desired.
> 
> ~ Matthew

Are you trying to resize them or chop them at a certain point. If it's
just a resize, it's probably easier to just use the "convert" program
that is part of ImageMagick rather than reinvent the wheel. I am
almost certain it provides a mechanism to resize files.

HTH,
Dave

___
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] Python & GDK || Suggestions

2003-03-30 Thread Metnetsky
On Sun, 2003-03-30 at 04:27, Thomas Speck wrote:
> On Sun, 2003-03-30 at 08:40, Metnetsky wrote:
> > I can't seem to find any good documentation/examples on GDK with
> > Python.  I'm not trying to do much, just open an image, shrink, and save
> > under a new name.  Simply put, I have a few hundred photos that need to
> > be cut in half by exactly 50%.  The program doesn't need an interface,
> > it should be run from a command prompt with a directory path passed as
> > an argument.  All images in the path are loaded and converted.  Any
> > suggestions on where/how to begin this?
> > 
> > ~ Matthew
> 
> I think what you are looking for is gtk.gdk.Pixbuf. As a starting point
> 
> import gtk
> pixbuf = gtk.gdk.pixbuf_new_from_file( 'file' )
> scaled = pixbuf.scale_simple( pixbuf.get_width()/2,
>pixbuf.get_height()/2, gtk.gdk.INTERP_BILINEAR )
> scaled.save( 'scaled.png', 'png' )
> 
> The documenation on this topic isn't the best but maybe you should look
> here:
> http://www.gnome.org/~james/pygtk-docs/class-gdkpixbuf.html
> 
> Thomas
> 
Thanks for the tip.

I tried the above code and some variations on the theme but the Python
interpreter keeps returning "AttributeError: 'gtk.gdk.Pixbuf' object has
no attribute 'save'".  Any suggestions?  I looked through the
documentation, but it definitely lacks something to be desired.

~ Matthew

___
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] Python & GDK || Suggestions

2003-03-30 Thread John K Luebs
On Sun, Mar 30, 2003 at 01:40:25AM -0500, Metnetsky wrote:
> I can't seem to find any good documentation/examples on GDK with
> Python.  I'm not trying to do much, just open an image, shrink, and save
> under a new name.  Simply put, I have a few hundred photos that need to
> be cut in half by exactly 50%.  The program doesn't need an interface,
> it should be run from a command prompt with a directory path passed as
> an argument.  All images in the path are loaded and converted.  Any
> suggestions on where/how to begin this?
> 
> ~ Matthew

Perhaps PIL (Python Imaging Library) is more appropriate for this task?

___
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] Adjusting a TreeView padding to the other elements of anHBox

2003-03-30 Thread Grzegorz Adam Hankiewicz
On 2003-02-23, Grzegorz Adam Hankiewicz <[EMAIL PROTECTED]> wrote:
> I have a VBox which contains a few buttons and a TreeView. For
> the buttons I call set_border_width(), but this doesn't have any
> effect on the TreeView.

I'm attaching an example which demonstrates this, built up from John
Finlay's tutorial and pygtk's demo (for the TreeView part). The
expected behaviour of the example is to display a button and a
list with three items with the same spacing, but the border of the
TreeView stays invariable. Is this a bug? Is this a feature?

I'm using Python 2.2.1 and PyGTK from CVS.
#!/usr/bin/env python

import gtk, gobject

class Test_window:

   def clicked_button1(self, widget):
  print "Button pressed"

   def delete_event(self, widget, event, data = None):
  return 0

   def __init__(self):
  # create the new window
  self.window = window = gtk.Window(gtk.WINDOW_TOPLEVEL)
  window.set_title("Welcome window")
  window.set_border_width(10)

  # delete handler to exit GTK
  window.connect("delete_event", self.delete_event)
  window.connect('destroy', lambda w: gtk.main_quit())

  # create a box to package interface elements inside
  self.box1 = box1 = gtk.VBox(0, 0)
  window.add(box1)

  # create a button
  self.button1 = button1 = gtk.Button("Create")
  box1.pack_start(button1, 1, 1, 0)
  button1.connect("clicked", self.clicked_button1)
  button1.set_border_width(5)
  button1.show()

  # create a list
  store = gtk.ListStore(gobject.TYPE_STRING)
  for entry in ["One item", "Anoter", "Oh, and this one"]:
 store.set(store.append(), 0, entry)

  self.list = list = gtk.TreeView(store)
  box1.pack_start(list)
  # the following line seems to be ignored
  list.set_border_width(50)
  list.set_rules_hint(1)
  list.set_headers_visible(0)

  column = gtk.TreeViewColumn('Description',
 gtk.CellRendererText(), text=0)
  list.append_column(column)
  list.show()

  # show elements
  box1.show()
  window.show()
  
if __name__ == '__main__':
   Test_window = Test_window()
   gtk.main()
___
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] Treeview with boolean checkboxes

2003-03-30 Thread David M. Cook
On Sat, Mar 29, 2003 at 11:33:49AM -0700, Jay Graves wrote:

> I have a project where I am using a treeview where one of the columns is
> a boolean (check box) field.  The behaviour I want is for only one check
> box to be checked at any time.  So if the user checks row 2 and then
> checks row 8, row 2 is automatically unchecked.  Is there a
> gtkTreeViewColumn setting that will set the functionality or is it
> something I will have to do manually?

What you want are radio buttons.  I haven't tried this, but from the docs,
it looks like you would use "radio" instead of "active" when adding a column:

cell = gtk.CellRendererToggle()
tvcolumn = gtk.TreeViewColumn('foo', cell, radio=RADIOCOLUMN)

However, it's not clear to me whether the radio buttons have to be grouped
or whether this does it for you.  See the FAQ:

http://www.async.com.br/faq/pygtk/index.py?req=all#9.1

Dave Cook
___
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] Python & GDK || Suggestions

2003-03-30 Thread Thomas Speck
On Sun, 2003-03-30 at 08:40, Metnetsky wrote:
> I can't seem to find any good documentation/examples on GDK with
> Python.  I'm not trying to do much, just open an image, shrink, and save
> under a new name.  Simply put, I have a few hundred photos that need to
> be cut in half by exactly 50%.  The program doesn't need an interface,
> it should be run from a command prompt with a directory path passed as
> an argument.  All images in the path are loaded and converted.  Any
> suggestions on where/how to begin this?
> 
> ~ Matthew

I think what you are looking for is gtk.gdk.Pixbuf. As a starting point

import gtk
pixbuf = gtk.gdk.pixbuf_new_from_file( 'file' )
scaled = pixbuf.scale_simple( pixbuf.get_width()/2,
 pixbuf.get_height()/2, gtk.gdk.INTERP_BILINEAR )
scaled.save( 'scaled.png', 'png' )

The documenation on this topic isn't the best but maybe you should look
here:
http://www.gnome.org/~james/pygtk-docs/class-gdkpixbuf.html

Thomas


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