[pygtk] Improved Masked Entry

2009-09-03 Thread Aidin Gharibnavaz
Hi guys!

I improved my masked entry a little. There's still some other
things that can be done to make it better.

Improved widget is attached to this mail, and there's a change
file which explains what's new.

I like to make it more standard, but to be honest, I couldn't found
any guide or something about how to standardize a GTK widget! Or
what are standards of a GTK widget. Do you know any page about it?

Thanks for spending your time examining my full-of-bugs widget.

Cheers,
Aidin


VirtualMaskedEntry.tar.bz2
Description: BZip2 compressed data
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] Quickly open and colse a windows due to a .hide() at start

2009-09-03 Thread Alexandre González
Hi guys!

I have an application that has two windows in the .glade: a main window and
a help window. When I run the application, the two windows are showed, so I
.hide() the help window... well.. here is the problem. Is It a good way to
do it?

In Ubuntu with gnome, (rox+xfce)... no problem! But when I test it in debian
Lenny with official repos, so I ask me if the problem could be a bug on
pygtk libraries in debian? It's the same computer, so no problem with
velocity or RAM.

Thanks!
Álex González

-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx
http://mirblu.com
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] Quickly open and colse a windows due to a .hide() at start

2009-09-03 Thread Timo
Alexandre González schreef:
 Hi guys!

 I have an application that has two windows in the .glade: a main 
 window and a help window. When I run the application, the two windows 
 are showed, so I .hide() the help window... well.. here is the 
 problem. Is It a good way to do it?
Why not set the Visible option to False in the Glade file (it's in the 
common-tab I think).
So the window isn't shown at program start and you can do a .show() when 
you need it.

Timo

 In Ubuntu with gnome, (rox+xfce)... no problem! But when I test it in 
 debian Lenny with official repos, so I ask me if the problem could be 
 a bug on pygtk libraries in debian? It's the same computer, so no 
 problem with velocity or RAM.

 Thanks!
 Álex González

 -- 
 Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, 
 .ppt and/or .pptx
 

 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] Quickly open and colse a windows due to a .hide() at start

2009-09-03 Thread Alexandre González
Good! It's solved... sorry, this is a stupid question because I've used
glade-3 since I develop python+pygtk, but this application is old and need
glade-2 and I've never see this option so, I think that it isn't allowed in
glade-2 ;)

Thanks for a good answer to my stupid question ;D
Álex González

2009/9/3 Timo timomli...@gmail.com

 Alexandre González schreef:

 Hi guys!

 I have an application that has two windows in the .glade: a main window
 and a help window. When I run the application, the two windows are showed,
 so I .hide() the help window... well.. here is the problem. Is It a good way
 to do it?

 Why not set the Visible option to False in the Glade file (it's in the
 common-tab I think).
 So the window isn't shown at program start and you can do a .show() when
 you need it.

 Timo


 In Ubuntu with gnome, (rox+xfce)... no problem! But when I test it in
 debian Lenny with official repos, so I ask me if the problem could be a bug
 on pygtk libraries in debian? It's the same computer, so no problem with
 velocity or RAM.

 Thanks!
 Álex González

 --
 Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx,
 .ppt and/or .pptx
 

 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/





-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx
http://mirblu.com
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] GTK: ERROR

2009-09-03 Thread Luis Javier Peris
Hello guys,

I'm writing here because I don't know where tell this issue. I'm writing an
app using pygtk and after calling the run method of a gtk.Dialog (response =
self.widgets.get_widget(dialogQuestion).run()), I get the following error:

Gtk:ERROR:/build/buildd/gtk+2.0-2.16.1/gtk/gtkcontainer.c:2717:IA__gtk_container_propagate_expose:
assertion failed: (child-parent == GTK_WIDGET (container))
Cancelado

The dialog is shown but inmediately crashes, the next statement is not
executed. What could I do?

I don't remember if I updated my gtk version, but I suppose I did and it's
maybe the reason because I'm getting the error listed above, maybe a bug?
I've read the same issue happen  Google Chromium.

Greetings.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] GTK: ERROR

2009-09-03 Thread Pietro Battiston
Il giorno gio, 03/09/2009 alle 17.15 +0200, Luis Javier Peris ha
scritto:
 Hello guys,
 
 I'm writing here because I don't know where tell this issue. I'm
 writing an app using pygtk and after calling the run method of a
 gtk.Dialog (response =
 self.widgets.get_widget(dialogQuestion).run()), I get the following
 error:
 
 Gtk:ERROR:/build/buildd/gtk+2.0-2.16.1/gtk/gtkcontainer.c:
 2717:IA__gtk_container_propagate_expose: assertion failed:
 (child-parent == GTK_WIDGET (container))
 Cancelado
 
 The dialog is shown but inmediately crashes, the next statement is not
 executed. What could I do?

You could attach a bigger piece of code (the smallest subset of your
code sufficient to easily reproduce the bug), from which we could
understand what's happening.

 
 I don't remember if I updated my gtk version, but I suppose I did and
 it's maybe the reason because I'm getting the error listed above,
 maybe a bug? I've read the same issue happen  Google Chromium.


What?!?


Pietro

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Gtkmozembed

2009-09-03 Thread Jeffrey Barish
Jeffrey Barish wrote:

 Does anyone know why this test program works with one string but not the
 other?  Using the load_url method works in both cases.

For the benefit of posterity, the problem is that gtkmozembed cannot swallow 
boluses of data larger than some amount.  If you feed the html to 
append_data in small bites in a loop, the page will display.  I found that 
chunks of 10 * 1024 worked.  Some documentation would help.
-- 
Jeffrey Barish


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] Make a square Window

2009-09-03 Thread Hidura
Good evening list, With what property in Cairo i can make a square like
this.

-- 
Hidura
attachment: Square.png___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] pygtk Digest, Vol 79, Issue 5

2009-09-03 Thread Luis Javier Peris
I've solved the problem. It happened because I unparent the vbox from the
main window but then I called to show_all() of the window so it crashed.

Thanks a lot.

Regards


2009/9/3 pygtk-requ...@daa.com.au

 Send pygtk mailing list submissions to
pygtk@daa.com.au

 To subscribe or unsubscribe via the World Wide Web, visit
http://www.daa.com.au/mailman/listinfo/pygtk
 or, via email, send a message with subject or body 'help' to
pygtk-requ...@daa.com.au

 You can reach the person managing the list at
pygtk-ow...@daa.com.au

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of pygtk digest...


 Today's Topics:

   1. Improved Masked Entry (Aidin Gharibnavaz)
   2. Quickly open and colse a windows due to a .hide() at start
  (Alexandre Gonz?lez)
   3. Re: Quickly open and colse a windows due to a .hide() at
  start (Timo)
   4. Re: Quickly open and colse a windows due to a .hide() at
  start (Alexandre Gonz?lez)
   5. GTK: ERROR (Luis Javier Peris)
   6. Re: Gtkmozembed (Jeffrey Barish)
   7. Re: GTK: ERROR (Pietro Battiston)


 --

 Message: 1
 Date: Thu, 3 Sep 2009 11:08:44 +0430
 From: Aidin Gharibnavaz ai...@aidinhut.com
 Subject: [pygtk] Improved Masked Entry
 To: pygtk@daa.com.au
 Message-ID:
9fbea0e0909022338s372721bchbfcd475698b0b...@mail.gmail.com
 Content-Type: text/plain; charset=iso-8859-1

 Hi guys!

 I improved my masked entry a little. There's still some other
 things that can be done to make it better.

 Improved widget is attached to this mail, and there's a change
 file which explains what's new.

 I like to make it more standard, but to be honest, I couldn't found
 any guide or something about how to standardize a GTK widget! Or
 what are standards of a GTK widget. Do you know any page about it?

 Thanks for spending your time examining my full-of-bugs widget.

 Cheers,
 Aidin
 -- next part --
 A non-text attachment was scrubbed...
 Name: VirtualMaskedEntry.tar.bz2
 Type: application/x-bzip2
 Size: 6059 bytes
 Desc: not available
 Url :
 http://www.daa.com.au/pipermail/pygtk/attachments/20090903/80bb9fbe/attachment-0001.bin

 --

 Message: 2
 Date: Thu, 3 Sep 2009 10:58:33 +0200
 From: Alexandre Gonz?lez a...@rianxosencabos.com
 Subject: [pygtk] Quickly open and colse a windows due to a .hide() at
start
 To: pygtk@daa.com.au
 Message-ID:
e9d8fca30909030158q46d4ea65j19f17bda94722...@mail.gmail.com
 Content-Type: text/plain; charset=utf-8

 Hi guys!

 I have an application that has two windows in the .glade: a main window and
 a help window. When I run the application, the two windows are showed, so I
 .hide() the help window... well.. here is the problem. Is It a good way to
 do it?

 In Ubuntu with gnome, (rox+xfce)... no problem! But when I test it in
 debian
 Lenny with official repos, so I ask me if the problem could be a bug on
 pygtk libraries in debian? It's the same computer, so no problem with
 velocity or RAM.

 Thanks!
 ?lex Gonz?lez

 --
 Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
 and/or .pptx
 http://mirblu.com
 -- next part --
 An HTML attachment was scrubbed...
 URL:
 http://www.daa.com.au/pipermail/pygtk/attachments/20090903/a1758425/attachment-0001.htm

 --

 Message: 3
 Date: Thu, 03 Sep 2009 11:16:34 +0200
 From: Timo timomli...@gmail.com
 Subject: Re: [pygtk] Quickly open and colse a windows due to a .hide()
at start
 To: Alexandre Gonz?lez a...@rianxosencabos.com
 Cc: pygtk@daa.com.au
 Message-ID: 4a9f8972.3080...@gmail.com
 Content-Type: text/plain; charset=UTF-8; format=flowed

 Alexandre Gonz?lez schreef:
  Hi guys!
 
  I have an application that has two windows in the .glade: a main
  window and a help window. When I run the application, the two windows
  are showed, so I .hide() the help window... well.. here is the
  problem. Is It a good way to do it?
 Why not set the Visible option to False in the Glade file (it's in the
 common-tab I think).
 So the window isn't shown at program start and you can do a .show() when
 you need it.

 Timo
 
  In Ubuntu with gnome, (rox+xfce)... no problem! But when I test it in
  debian Lenny with official repos, so I ask me if the problem could be
  a bug on pygtk libraries in debian? It's the same computer, so no
  problem with velocity or RAM.
 
  Thanks!
  ?lex Gonz?lez
 
  --
  Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx,
  .ppt and/or .pptx
  
 
  ___
  pygtk mailing list   pygtk@daa.com.au
  http://www.daa.com.au/mailman/listinfo/pygtk
  Read the PyGTK FAQ: http://faq.pygtk.org/



 --

 Message: 4
 Date: Thu, 3 Sep 2009 11:55:40 +0200
 From

Re: [pygtk] Trying to change the pen color just before I draw a line

2009-09-03 Thread Rick Hightower
Thanks. That worked very well.
Thanks for taking the time to respond.
In celebration, I have added a green rectangle.

Here is the working code:

import pygtk
pygtk.require(2.0)
import gtk
from gtk import Window, Button

class Base:
def handle_color_change(self, widget, data) :
self.color = data
if self.color == Red:
gdk_color = gtk.gdk.color_parse(Red)
elif self.color == Green:
gdk_color = gtk.gdk.color_parse(Green)
else:
gdk_color = gtk.gdk.color_parse(Blue)
style = self.area.get_style().copy()
style.bg[gtk.STATE_NORMAL] = gdk_color
self.area.set_style(style)
self.area.queue_draw()

def __init__(self):
self.color = None
self.window = Window(gtk.WINDOW_TOPLEVEL)
self.window.connect(destroy, lambda w: gtk.main_quit())

self.mainPane = gtk.VBox(False, 0)
self.window.add(self.mainPane)
# create the toolbar
self.toolbar = gtk.HBox(False, 0)
self.green = Button('Green')
self.red = Button ('Red')
self.toolbar.pack_start(self.green, True, True, 0)
self.toolbar.pack_start(self.red, True, True, 0)
self.mainPane.pack_start(self.toolbar, True, True, 0)
self.red.connect(clicked, self.handle_color_change, Red)
self.green.connect(clicked, self.handle_color_change, Green)


#Create the drawing area
self.area = gtk.DrawingArea()
self.area.set_size_request(400, 300)
self.area.connect(expose-event, self.area_expose)
self.mainPane.pack_start(self.area, True, True, 0)

self.window.show_all()

def area_expose(self, area, event):
print (area exposed)
gc = self.area.get_style().fg_gc[gtk.STATE_NORMAL]
gc=self.area.window.new_gc()

gdk_color = gc.get_colormap().alloc_color(Green)
gc.set_foreground(gdk_color)
#draw_rectangle(gc, filled, x, y, width, height)
self.area.window.draw_rectangle(gc, True, 0, 0, 80, 70)


gdk_color = gc.get_colormap().alloc_color(Blue)
gc.set_foreground(gdk_color)
self.area.window.draw_line(gc,  0, 0, 80, 70)

return False

def main(self):
gtk.main()

if __name__ == __main__:
base = Base()
base.main()


And now I do a victory dance... hoot hoot! hoot hoot! HOOT!
Mdd dada do do doh mmm dada doh doh! bogaboga!


On Wed, Sep 2, 2009 at 8:16 PM, John Finlay fin...@moeraki.com wrote:

 Rick Hightower wrote:

 snip

 Here is the full program. It changes the background color and redraws.
 I need to be able to draw different color lines.

 import pygtk
 pygtk.require(2.0)
 import gtk
 from gtk import Window, Button

 class Base:
 def handle_color_change(self, widget, data) :
 self.color = data
 if self.color == Red:
 gdk_color = gtk.gdk.color_parse(Red)
 elif self.color == Green:
 gdk_color = gtk.gdk.color_parse(Green)
 else:
 gdk_color = gtk.gdk.color_parse(Blue)
 style = self.area.get_style().copy()
 style.bg http://style.bg[gtk.STATE_NORMAL] = gdk_color

 self.area.set_style(style)
 self.area.queue_draw()

 def __init__(self):
 self.color = None
 self.window = Window(gtk.WINDOW_TOPLEVEL)
 self.window.connect(destroy, lambda w: gtk.main_quit())

 self.mainPane = gtk.VBox(False, 0)
 self.window.add(self.mainPane)
 # create the toolbar
 self.toolbar = gtk.HBox(False, 0)
 self.green = Button('Green')
 self.red = Button ('Red')
 self.toolbar.pack_start(self.green, True, True, 0)
 self.toolbar.pack_start(self.red, True, True, 0)
 self.mainPane.pack_start(self.toolbar, True, True, 0)
 self.red.connect(clicked, self.handle_color_change, Red)
 self.green.connect(clicked, self.handle_color_change, Green)


 #Create the drawing area
 self.area = gtk.DrawingArea()
 self.area.set_size_request(400, 300)
 self.area.connect(expose-event, self.area_expose)
 self.mainPane.pack_start(self.area, True, True, 0)

 self.window.show_all()

 def area_expose(self, area, event):
 print (area exposed)

 v delete vv

 gc = self.area.get_style().fg_gc[gtk.STATE_NORMAL]
 gdk_color = gtk.gdk.color_parse(Blue)
 gc.get_colormap().alloc_color(gdk_color)

 ^^ delete ^^^

 v add v

  gc=self.area.window.new_gc()
  gdk_color = gc.get_colormap().alloc_color(Blue)

 ^^ add ^^

 gc.set_foreground(gdk_color)
   self.area.window.draw_line(gc, 0, 0, 80, 70)
 return False

 def main(self):
 gtk.main()

 if __name__ == __main__:
 base = Base()
 base.main()


 You could create the GC  and color up front and reuse it in the expose
 event handler to simplify.

 john

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] Make a square Window

2009-09-03 Thread Pietro Battiston
Il giorno gio, 03/09/2009 alle 15.38 -0400, Hidura ha scritto:
 Good evening list, With what property in Cairo i can make a square
 like this.

square?! That is not a square.
And I'm afraid this is not a list about Cairo properties
Anyway, take a look at cairo snippets.

Pietro

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Gtkmozembed

2009-09-03 Thread John Stowers
On Thu, 2009-09-03 at 10:33 -0600, Jeffrey Barish wrote:
 Jeffrey Barish wrote:
 
  Does anyone know why this test program works with one string but not the
  other?  Using the load_url method works in both cases.

I would also recommend moving to PyWebitGtk asap. GtkMozembed is a train
wreck.

John


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Gtkmozembed

2009-09-03 Thread Jeffrey Barish
John Stowers wrote:

 I would also recommend moving to PyWebitGtk asap. GtkMozembed is a train
 wreck.

Can you say more about what's wrong with GtkMozembed?  Also, can you direct 
me to documentation for PyWebkitGtk?
-- 
Jeffrey Barish


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] Fwd: Make a square Window

2009-09-03 Thread Hidura
Does have Cairo a Mailing List?

-- Forwarded message --
From: Pietro Battiston too...@email.it
Date: Thu, Sep 3, 2009 at 4:35 PM
Subject: Re: [pygtk] Make a square Window
To: Hidura hid...@gmail.com
Cc: pygtk@daa.com.au


Il giorno gio, 03/09/2009 alle 15.38 -0400, Hidura ha scritto:
 Good evening list, With what property in Cairo i can make a square
 like this.

square?! That is not a square.
And I'm afraid this is not a list about Cairo properties
Anyway, take a look at cairo snippets.

Pietro




-- 
Hidura
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] Fwd: Make a square Window

2009-09-03 Thread Pietro Battiston
Il giorno gio, 03/09/2009 alle 20.21 -0400, Hidura ha scritto:
 Does have Cairo a Mailing List?
 

Searching cairo mailing list on google returns as first result:
http://lists.cairographics.org/mailman/listinfo/cairo

(but really, you find everything you need in the snippets:
http://cairographics.org/samples/ )

Pietro

 -- Forwarded message --
 From: Pietro Battiston too...@email.it
 Date: Thu, Sep 3, 2009 at 4:35 PM
 Subject: Re: [pygtk] Make a square Window
 To: Hidura hid...@gmail.com
 Cc: pygtk@daa.com.au
 
 
 Il giorno gio, 03/09/2009 alle 15.38 -0400, Hidura ha scritto:
  Good evening list, With what property in Cairo i can make a square
  like this.
 
 
 square?! That is not a square.
 And I'm afraid this is not a list about Cairo properties
 Anyway, take a look at cairo snippets.
 
 Pietro
 
 
 
 
 
 -- 
 Hidura
 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Circular Button

2009-09-03 Thread Pietro Battiston
Il giorno mer, 02/09/2009 alle 21.13 +, hid...@gmail.com ha scritto:
 How could i create a Circular Button?

The attached is ugly code I had somewhere, but it can give you an idea.

I'm not sure however it will work outside Linux.

Pietro


import gtk, gobject


N,M=200,200

drag_icon_xpm = [
str(N)+ +str(M)+ 1 1,
   c None]+[' '*N]*M


w = gtk.Window()

def apply_mask():
p = gtk.gdk.pixmap_create_from_xpm_d(w.window , None, drag_icon_xpm)[1]
r=p.cairo_create()
r.arc(N/2, M/2, min(N,M)/2, .0001, 0)
r.fill()
w.shape_combine_mask(p, 0, 0)
w.set_decorated(False)
return

def set_back():
m = gtk.gdk.bitmap_create_from_data(None, '0x00, 0x00, '*1000, 300, 300)
w.shape_combine_mask(m, 0, 0)

b=gtk.Button(Click me,\n stupid)
w.add(b)
b.connect('released', gtk.main_quit)
w.set_size_request(200,200)
w.show_all()

gobject.idle_add(apply_mask)

gtk.main()


signature.asc
Description: Questa è una parte del messaggio firmata digitalmente
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/