Re: [pygtk] How to set a wiget, eg a button size?

2012-04-20 Thread craf

Hi All,
   when i put some buttons in a hbutton box, the hbutton box
becomes very long
   i don't know how to set a button size, set_size_request has no
effect

   could anybody help me how to set the size for widgets?
   thanks

  Lion

Hi Lion

Have your code to see you're doing?

Regards

Craf



___
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] run a program with 2 windows on separate monitors

2012-01-11 Thread craf
Yes, but I reckon window management is out of the scope of GTK+. Use the  
same class on both windows (IIRC windows spawned by the same GTK+  
executable use the same class by default). Then write a window manager  
that groups windows by class (where class = Application name).

Thank you!.

Regards,

cris


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


[pygtk] run a program with 2 windows on separate monitors

2012-01-10 Thread craf
Hi.

Is it possible to run a program with 2 windows on separate monitors?

Example:


Monitor One  Monitor Two
 ___   ___
| _ | | _ |
|| || || ||
||  Window Main|| ||  Window Child   ||
||     || ||     ||
||  |__|-|+|x| || ||  |__|-|+|x| ||
||  || || ||  || ||
||  || || ||  || ||
||  || || ||  || ||
||  || || ||  || ||
|| || || ||
||_|| ||_||
|___| |___|
  / \/ \
 /   \  /   \
/_\/_\


Best regards.

Cris.

___
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: Gtk.Box, homogeneous and expand]

2012-01-03 Thread craf
Hi.

Test this...

import gtk


class App:

def __init__(self):

self.ventana = gtk.Window()
self.ventana.set_default_size(100, 100)
self.ventana.set_position(gtk.WIN_POS_CENTER)

self.hbox1 = gtk.HBox()

self.hbox2 = gtk.HBox(True)

self.button1 = gtk.Button(1234)
self.button2 = gtk.Button(123)
self.button3 = gtk.Button(12)

self.hbox2.pack_start(self.button1, False)
self.hbox2.pack_start(self.button2, False)
self.hbox2.pack_start(self.button3, False)

self.hbox1.pack_start(self.hbox2, False)

self.ventana.add(self.hbox1)
self.ventana.show_all()

self.ventana.connect(destroy, lambda e:gtk.main_quit())



App()
gtk.main()

Regards.

Cris.
- Mensaje reenviado 
 De: Jérôme jer...@jolimont.fr
 Para: pygtk@daa.com.au
 Asunto: [pygtk] Gtk.Box, homogeneous and expand
 Fecha: Tue, 3 Jan 2012 14:42:27 +0100
 
 Hi.
 
 There's something I don't get with the behaviour of homogeneous in Gtk.Box. I
 guess there must be a reason for it working this way. I just don't get the
 logic.
 
 From http://pygtk.org/pygtk2tutorial/sec-DetailsOfBoxes.html :
 
 The homogeneous argument [... ]controls whether each object in the box has
 the same size.
 
 If homogeneous is set, then the pack routines function essentially as if
 the expand argument was always turned on.
 
 Though it works as if the expand argument was always turned on, each
 object in the box has the same size is not really what I see.
 
 What I see :
 --
 
 1.a/
 homogeneous = True
 expand = whatever
 fill = False (for all objects)
 - Objects are scattered along the line (it is a HBox), with space in
 between. They may be provided equal space, but don't actually fill it, so
 they appear with different sizes.
 
 [  |a|   |abc|||  ]
 
 
 1.b/
 homogeneous = True
 expand = whatever
 fill = True (for all objects)
 - Objects use all the line and are of equal size
 
 [|  a  || abc ||| ]
 
 
 What I would expect :
 ---
 
 2.a/
 homogeneous = True
 expand = False
 fill = whatever
 - Objects would be of the same size : the size of the largest one, and they
 would be left-aligned (pack_start() being used).
 
 [| a ||abc||   |  ]
 
 
 2.b/
 homogeneous = True
 expand = True
 fill = False
 - Objects would be of the same size : the size of the largest one, and they
 would be scattered along the line with space in between.
 
 [ | a |  |abc|  |   | ]
 
 
 2.c/
 homogeneous = True
 expand = True
 fill = True
 - Objects would be of the same size and fill the line.
 
 [|  a  || abc || |]
 
 
 This seems more logical to me. I can't figure out why it does not work this
 way. 
 
 Besides, I don't see how to obtain 2.a/ any other way.
 
 Am I the only one who would expect things to work this way (or at least a
 different way) ?
 
 -- 
 Jérôme
 ___
 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] [Fwd: Gtk.Box, homogeneous and expand]

2012-01-03 Thread craf

And I don't see how to use that if I have two pack_start() and one pack_end()
and want all my objects to be of the same size, like this :

[|abc|| a |  | . |]

Hi.

test if it helps

import gtk


class App:

def __init__(self):

self.window = gtk.Window()
self.window.set_default_size(100, 100)
self.window.set_position(gtk.WIN_POS_CENTER)

self.hbox = gtk.HBox()

self.button1 = gtk.Button(1234)
self.button1.set_size_request(50, -1)

self.button2 = gtk.Button(123)
self.button2.set_size_request(50, -1)

self.button3 = gtk.Button(12)
self.button3.set_size_request(50, -1)

self.hbox.pack_start(self.button1, False)
self.hbox.pack_start(self.button2, False)
self.hbox.pack_end(self.button3, False)



self.window.add(self.hbox)
self.window.show_all()

self.window.connect(destroy, lambda e:gtk.main_quit())

App()
gtk.main()

Best Regards

Cris
___
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] Fullscreen on second monitor

2011-12-25 Thread craf
Hi Thomas.

The problem may be related to the distribution of ubuntu and the type of
video card installed.

I have a Ubuntu 9.10 and ATI video card, and your code recognizes me 2
monitors. But if I run it on a newer version of Ubuntu does not work.

That's why I use a distribution as old as the newest, I do not recognize
the second monitor.

Regards.

Craf

-Mensaje original-
De: Thomas Güttler guet...@thomas-guettler.de
Para: pygtk@daa.com.au
Asunto: [pygtk] Fullscreen on second monitor
Fecha: Sat, 24 Dec 2011 23:26:27 +0100

Hi,

how can I show the fullscreen window on the secondary monitor?

At best, the fullscreen mode should start on this screen where,
the current (not fullscreen) application is running.

At the moment the fullscreen is on my laptop, and not on the
secondary monitor.


With pygtk I can't seem to find a secondary screen:

 display_manager = gtk.gdk.display_manager_get()
 for display in display_manager.list_displays():
 print display
 for num in range(display.get_n_screens()):
 screen=display.get_screen(num)
 print 'screen', screen

output:

gtk.gdk.DisplayX11 object at 0xa74ddec (GdkDisplayX11 at 0xa34b008)
screen gtk.gdk.ScreenX11 object at 0xa74dd24 (GdkScreenX11 at 0xa34e0d8)

I use Ubuntu 11.10.





___
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] set focus in dialog

2011-11-18 Thread craf
Hi Andrew

Works very well!

Thank you very much.

Best Regards.

Cristian

-Mensaje original-
De: Andrew Steele andrew.ste...@gmx.com
Para: craf pyclut...@gmail.com
Cc: Pygtk pygtk@daa.com.au
Asunto: Re: [pygtk] set focus in dialog
Fecha: Fri, 18 Nov 2011 15:23:20 +

#!/usr/bin/env python

import gtk

class Dialog:   
def __init__(self):
dialog = gtk.Dialog(Dialog Example, None, 0,
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK))
dialog.set_default_size(250, 300)
label = gtk.Entry()

buttonbox = dialog.get_action_area()
buttons = buttonbox.get_children()
dialog.set_focus(buttons[0])

dialog.vbox.pack_start(label, True, True, 0)
dialog.show_all()

response = dialog.run()

if response == gtk.RESPONSE_OK:
print OK
elif response == gtk.RESPONSE_CANCEL:
print CANCEL

dialog.destroy()

Dialog()

The above is the easiest and quickest way I can think of. Essentially, you 
access the ButtonBox which holds the buttons specified when constructing the 
Dialog and retrieve the Button. This allows you to set the focus before the 
Dialog is shown.

I have a feeling there is a better way, though it's not obvious to me at the 
moment.

On Thu, 17 Nov 2011 12:42:36 -0300
craf pyclut...@gmail.com wrote:

 Hi.
 
 Is there any way to the OK button, keep the focus to start the program,
 and not the entry control?
 
 Here Code:-
 
 #!/usr/bin/env python
 
 import gtk
 
 class Dialog:   
 def __init__(self):
 dialog = gtk.Dialog(Dialog Example, None, 0,
 (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK))
 dialog.set_default_size(250, 300)
 label = gtk.Entry()
 
 dialog.vbox.pack_start(label, True, True, 0)
 dialog.show_all()
 
 response = dialog.run()
 
 if response == gtk.RESPONSE_OK:
 print OK
 elif response == gtk.RESPONSE_CANCEL:
 print CANCEL
 
 dialog.destroy()
 
 Dialog()
 
 
 Thanks in advance!
 
 Regards.
 
 CRAF
 
 ___
 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] Site down

2011-11-18 Thread craf
Thank you Dieter.

Regards,

Cristian

-Mensaje original-
De: Dieter Verfaillie diet...@optionexplicit.be
Para: craf pyclut...@gmail.com
Cc: Pygtk pygtk@daa.com.au
Asunto: Re: [pygtk] Site down
Fecha: Fri, 18 Nov 2011 20:03:13 +0100

On 16/11/2011 15:59, craf wrote:
 Hi.
 
 Does anyone know if the site is under maintenance?

pygtk.org is back in business :)

mvg,
Dieter



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


[pygtk] Site down

2011-11-16 Thread craf
Hi.

Does anyone know if the site is under maintenance?

Regards.

Craf

___
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] window set_default_size VS set_usize

2011-11-15 Thread craf
-Mensaje original-
De: Liu ChuanRen liuchuan...@gmail.com
Para: pygtk@daa.com.au
Asunto: [pygtk] window set_default_size VS set_usize
Fecha: Sat, 22 Oct 2011 13:36:14 -0400

Hi all,


I am a beginner, my first question is what is the different between
window method
set_default_size VS set_usize


I tried both, it seems set_default_size will be overrode if the content
is too much, the size will be larger, while set_usize will not be
overrode.


Is this correct? I can not find document of set_usize. Is it
deprecated? 

Yes, is deprecated.

Regards.


Liu ChuanRen
___
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] Refresh DrawingArea

2011-11-11 Thread craf
Hi Dieter.

Thanks for you answer.

Regards.

Cristian

-Mensaje original-
De: Dieter Verfaillie diet...@optionexplicit.be
Para: craf pyclut...@gmail.com
Cc: Pygtk pygtk@daa.com.au
Asunto: Re: [pygtk] Refresh DrawingArea
Fecha: Fri, 11 Nov 2011 09:30:44 +0100

On Thu, 10 Nov 2011 19:08:32 -0300, craf wrote:
 Hi.

 Is there a way to refresh a control DrawingArea?.

You can call queue_draw() or queue_draw_area(x, y, width, height)
on it. See 
http://www.pygtk.org/docs/pygtk/class-gtkwidget.html#method-gtkwidget--queue-draw

mvg,
Dieter




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


[pygtk] Refresh DrawingArea

2011-11-10 Thread craf
Hi.

Is there a way to refresh a control DrawingArea?.

Thanks in advance.

Regards.

___
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] Double row in a liststore, or in a Treeview

2011-10-28 Thread craf
Hi Andrew.

Thank you for your answer!!

The code works very Fine!.

Best Regards

Cristian.
-Mensaje original-
De: Andrew Steele andrew.ste...@gmx.com
Para: craf pyclut...@gmail.com
Cc: Pygtk pygtk@daa.com.au
Asunto: Re: [pygtk] Double row in a liststore, or in a Treeview
Fecha: Fri, 28 Oct 2011 09:35:18 +0100

Below is a basic example. Essentially, when populating the ListStore you
need to insert '\n' to indicate the line break.

#!/usr/bin/env python

import gtk

window = gtk.Window()
window.connect(destroy, lambda q: gtk.main_quit())

liststore = gtk.ListStore(str)
liststore.append([apple.jpg\n314KB])
liststore.append([orange.jpg\n495KB])
liststore.append([banana.jpg\n417KB])

treeview = gtk.TreeView(liststore)
treeviewcolumn = gtk.TreeViewColumn()
treeview.append_column(treeviewcolumn)
cellrenderertext = gtk.CellRendererText()
treeviewcolumn.pack_start(cellrenderertext, True)
treeviewcolumn.add_attribute(cellrenderertext, text, 0)

window.add(treeview)
window.show_all()

gtk.main()

Obviously you'll be wanting to dynamically specify the values rather
than statically as above (i.e. filename, file size, etc) so you can make
use of string formatters such as %s:

filename = grapes.png
filesize = 557KB
liststore.append([%s\n%s % (filename, filesize)])

Hope that helps.

On Thu, 2011-10-27 at 20:41 -0300, craf wrote:
 Hi.
 
 I wonder if it is possible that a liststore has a double row, such as
 using the Firefox download page.
 
 Example
 
 -
 |Downloads|x|
 -
 |Space.pdf   20:23  |
 |  ICON  4.9 MB - google.cl |
 |   |
 |  ICON  Picture_sky.jpeg   |
 |205 KB - google.cl |
 |   |
  ---
 
 Any indication, Thanks
 
 Regards.
 
 
 Craf
 
 
 ___
 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/


[pygtk] Double row in a liststore, or in a Treeview

2011-10-27 Thread craf
Hi.

I wonder if it is possible that a liststore has a double row, such as
using the Firefox download page.

Example

-
|Downloads|x|
-
|Space.pdf   20:23  |
|  ICON  4.9 MB - google.cl |
|   |
|  ICON  Picture_sky.jpeg   |
|205 KB - google.cl |
|   |
 ---

Any indication, Thanks

Regards.


Craf


___
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] importing list from another python file

2011-10-25 Thread craf
Hi Ravi.

Why don't use the class ConfigParser, for save your config.

http://docs.python.org/release/2.6.7/library/configparser.html?highlight=configparser#ConfigParser.ConfigParser

Best Regards.

Craf

-Mensaje original-
De: ravi ravi shaw...@yahoo.co.uk
Para: pygtk@daa.com.au
Asunto: [pygtk] importing list from another python file
Fecha: Wed, 26 Oct 2011 00:42:55 +0100 (BST)



Hello all,

I am using python and pygtk to create a GUI. I am storing all the
values that are to be displayed, in a list.
-- The values are calculated and stored in a list in the first file
-- The list is imported in to the second file which is GUI
file(contains gtk.main()) by using IMPORT statement.

problem:

The list is continuously appended in the first file, but this does not
reflect when imported in to the second file. The second file only shows
an empty list. I need to get an updated list in my GUI file.Please help
me out

Thank you,

Ravindra Nagireddy




___
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] Treeview adding content dynamically

2011-10-15 Thread craf
Hi.

This?

http://www.learngtk.org/pygtk-tutorial/liststore.html

Regards.

Craf

-Mensaje original-
De: Arun p das arunpdas...@gmail.com
Para: Glade Users Mailing List glade-us...@lists.ximian.com, Pygtk
Mailing list pygtk@daa.com.au
Asunto: [pygtk] Treeview adding content dynamically
Fecha: Sun, 16 Oct 2011 03:02:09 +0530

hi

I have already created 
model Liststore
view   cell renderer
GtkTreeView 

using Glade. I got how to add the contents with the help of glade. 
But i dont know how to add contents with the help of pygtk to a already
created one like the above.

ie in existence i have one treeview made with the help of glade how to
add contents to this existing one through pygtk? Does any one know the
code please share or give the link to tutorial
___
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] Treeview adding content dynamically

2011-10-15 Thread craf
Hi.

This?

http://www.learngtk.org/pygtk-tutorial/liststore.html

Regards.

Craf

-Mensaje original-
De: Arun p das arunpdas...@gmail.com
Para: Glade Users Mailing List glade-us...@lists.ximian.com, Pygtk
Mailing list pygtk@daa.com.au
Asunto: [pygtk] Treeview adding content dynamically
Fecha: Sun, 16 Oct 2011 03:02:09 +0530

hi

I have already created 
model Liststore
view   cell renderer
GtkTreeView 

using Glade. I got how to add the contents with the help of glade. 
But i dont know how to add contents with the help of pygtk to a already
created one like the above.

ie in existence i have one treeview made with the help of glade how to
add contents to this existing one through pygtk? Does any one know the
code please share or give the link to tutorial
___
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] Treeview adding content dynamically

2011-10-15 Thread craf
Hi.

This?

http://www.learngtk.org/pygtk-tutorial/liststore.html

Regards.

Craf


-Mensaje original-
De: Arun p das arunpdas...@gmail.com
Para: Glade Users Mailing List glade-us...@lists.ximian.com, Pygtk
Mailing list pygtk@daa.com.au
Asunto: [pygtk] Treeview adding content dynamically
Fecha: Sun, 16 Oct 2011 03:02:09 +0530

hi

I have already created 
model Liststore
view   cell renderer
GtkTreeView 

using Glade. I got how to add the contents with the help of glade. 
But i dont know how to add contents with the help of pygtk to a already
created one like the above.

ie in existence i have one treeview made with the help of glade how to
add contents to this existing one through pygtk? Does any one know the
code please share or give the link to tutorial
___
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/


[pygtk] Problems with coordinates in a drawing area control

2011-10-14 Thread craf
Hi everyone!

I'm trying to learn PyCairo, and using the following code, I created a
window with a scale of 200 x 200


CODE:-

#!/usr/bin/python

import gtk


class Window():

def __init__(self):

self.window = gtk.Window()  
self.drwArea = gtk.DrawingArea()

self.window.add(self.drwArea)
self.window.show_all()

# Events-
  
self.drwArea.add_events(gtk.gdk.POINTER_MOTION_MASK)


# Signals-

self.window.connect(destroy, lambda e:gtk.main_quit())

self.drwArea.connect(expose-event, expose, self)

self.drwArea.connect(motion-notify-event, motion_notify,
self)
 

def expose(widget, event, self):

cr = widget.window.cairo_create()

cr.scale(200,200)
   

def motion_notify(widget, event, self):

print x=%d y=%d % (event.x, event.y)
 
Window()
gtk.main()

-CODE:---

The problem is the coordinate system, leaving the point (0.0) in:

 __
|(0,0) |
|  |
|  |
|  |
|  |
|  |
|__|

and I want to stay well:

___
|  |
|  |
|  |
|  |
|  |
|  |
|(0,0)_|


I tested with cr.translate (-200, -200), but does not work.


I appreciate any suggestions.

Regards.

Craf.


DATES:
Python 2.6.4
Ubuntu 9.10
Gnome 2.28.0

___
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] Problems with coordinates in a drawing area control

2011-10-14 Thread craf
Hi Jamie

Thank you very much for answering, if you could give me a small
example,I appreciate it.

I probe with cr.translate(0,-1 * 200), but nothing

Regards

Craf
-Mensaje original-
De: Jamie Bliss astronouth7...@gmail.com
Para: craf pyclut...@gmail.com
Cc: Pygtk pygtk@daa.com.au
Asunto: Re: [pygtk] Problems with coordinates in a drawing area control
Fecha: Fri, 14 Oct 2011 18:32:03 -0400

The X requires no change. Just flip and translate the Y.

On Fri, Oct 14, 2011 at 12:52 PM, craf pyclut...@gmail.com wrote:
 Hi everyone!

 I'm trying to learn PyCairo, and using the following code, I created a
 window with a scale of 200 x 200


 CODE:-

 #!/usr/bin/python

 import gtk


 class Window():

def __init__(self):

self.window = gtk.Window()
self.drwArea = gtk.DrawingArea()

self.window.add(self.drwArea)
self.window.show_all()

# Events-

self.drwArea.add_events(gtk.gdk.POINTER_MOTION_MASK)


# Signals-

self.window.connect(destroy, lambda e:gtk.main_quit())

self.drwArea.connect(expose-event, expose, self)

self.drwArea.connect(motion-notify-event, motion_notify,
 self)


 def expose(widget, event, self):

cr = widget.window.cairo_create()

cr.scale(200,200)


 def motion_notify(widget, event, self):

print x=%d y=%d % (event.x, event.y)

 Window()
 gtk.main()

 -CODE:---

 The problem is the coordinate system, leaving the point (0.0) in:

  __
 |(0,0) |
 |  |
 |  |
 |  |
 |  |
 |  |
 |__|

 and I want to stay well:

 ___
 |  |
 |  |
 |  |
 |  |
 |  |
 |  |
 |(0,0)_|


 I tested with cr.translate (-200, -200), but does not work.


 I appreciate any suggestions.

 Regards.

 Craf.


 DATES:
 Python 2.6.4
 Ubuntu 9.10
 Gnome 2.28.0

 ___
 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] sentence twice impression

2011-05-16 Thread craf
-Mensaje original-
De: Alessandro Dentella san...@e-den.it
Para: craf pyclut...@gmail.com
Cc: Python Pygtk pygtk@daa.com.au
Asunto: Re: [pygtk] sentence twice impression
Fecha: Mon, 16 May 2011 09:13:49 +0200

On Sun, May 15, 2011 at 10:26:50PM -0400, craf wrote:
 Hi.
 
 It is possible to prevent the print statement, printed on the screen 2
 times?


sure, it depends on what you want. callback function is called 2 times, one
when one radio is clicked (so that it's toggled) and the other when the
other is toggled as if belongs to the same group.

the callback function prints only for a toggle from True = False otherwise
you would see also a couple of prin forthe simmetrical transition, but
independently from which button triggered the call.

Depending on what you want you can just add an argument to the function and
call directly the correct radiobutton, 

  self.radiobutton.connect('toggled', function, radiobutton)
  self.radiobutton1.connect('toggled', function, radiobutton1)

  def function(butt, radio):
 if radio.get_active():
 print radio

in more complex case I needed to inhibit further processing of the signal:

self.gtkwidget.handler_block(self._clicked_id)

self.gtkwidget.set_inconsistent(False)
self.gtkwidget.set_active(value)

self.gtkwidget.handler_unblock(self._clicked_id)


your milage may vary, but if you understand why you get it twice it's not
diffucult to change it to your need.


sandro
*:-)

Hi Alessandro.

Thank you very much for your response!.

Regards.

Cristian



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


[pygtk] sentence twice impression

2011-05-15 Thread craf
Hi.

It is possible to prevent the print statement, printed on the screen 2
times?

Code:-

#!/usr/bin/env python

import gtk

class RadioButton:
def __init__(self):
self.window = gtk.Window()
self.vbox = gtk.VBox()

self.radiobutton = gtk.RadioButton(None, One)
self.radiobutton1 = gtk.RadioButton(self.radiobutton, Two)
self.radiobutton2 = gtk.RadioButton(self.radiobutton, Three)


self.window.add(self.vbox)
self.vbox.pack_start(self.radiobutton)
self.vbox.pack_start(self.radiobutton1)
self.vbox.pack_start(self.radiobutton2)
  
self.window.connect(destroy, lambda w: gtk.main_quit())

self.radiobutton.connect('toggled', lambda e, widget=self:
function(widget))
self.radiobutton1.connect('toggled', lambda e, widget=self:
function(widget))
self.radiobutton2.connect('toggled', lambda e, widget=self:
function(widget))
self.window.show_all()

def function(widget):
if widget.radiobutton.get_active() == True:
print one
elif widget.radiobutton1.get_active() == True:
print Two
elif widget.radiobutton2.get_active() == True:
print Three

RadioButton()
gtk.main()


Regards.

Cristian

___
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 toggle hide show with time interval

2011-05-06 Thread craf
hi.

import gtk, pygtk
pygtk.require('2.0')
import time

class test():
  def __init__(self):
self.window=gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect=('delete_event',lambda wid, we: gtk.main_quit())
self.window.show()
gtk.gdk.flush()
print show
time.sleep(2)
self.window.hide()
gtk.gdk.flush()
print hide
time.sleep(3)
self.window.show()
print show

if __name__ == __main__:
  test()
  gtk.main()


Regards.

Cristian

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


[pygtk] Autocomplete in Widget ComboBoxEntry

2011-04-29 Thread craf
Hi.

There a way to assign the event autocomplete to a widget ComboBoxEntry?

Thanks in advance.

Regards

Cristian

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


[pygtk] Method set_wrap_mode of widget TextView

2011-04-29 Thread craf
Hi.

Anyone know if the method of widget gtk.TextView (set_wrap_mode) , can
be applied also to widget gtksourceview?

Regards.

Cristian Abarzúa F.

___
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] Method set_wrap_mode of widget TextView

2011-04-29 Thread craf
-Mensaje original-
De: Giuseppe Penone gius...@gmail.com
Para: craf pyclut...@gmail.com
Cc: Python Pygtk pygtk@daa.com.au
Asunto: Re: [pygtk] Method set_wrap_mode of widget TextView
Fecha: Fri, 29 Apr 2011 22:48:27 +0200

As you can read from the reference page
(http://www.pygtk.org/pygtksourceview/class-gtksourceview.html),


class gtksourceview.SourceView(gtk.TextView):
gtksourceview.SourceView(buffer=None)


gtksourceview.SourceView inherits from gtk.TextView, so the answer is
yes.


cheers,
Giuseppe.

Hi Giuseppe.

Thank you very much, for your answer!

Best Regards.

Cristian



___
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] Number lines in a textview control

2011-04-28 Thread craf

you have to use gtksourceview rather than gtktextview:
http://www.pygtk.org/pygtksourceview/class-gtksourceview.html#method-gtksourceview--set-show-line-numbers
cheers,
Giuseppe.

Hi Giuseppe.

Thank for the information!

Regards

cristian




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


[pygtk] Number lines in a textview control

2011-04-27 Thread craf
Hi.

I searched Google, but can not find a clear way of how to number lines
in a TextView control.
Any information you could give me an idea, thanks in advance!

Regards.

Cristian Abarzúa


___
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] pygoocanvas questions

2011-04-26 Thread craf
Hi to all,
I've a couple of questions regarding pygoocanvas. 
(I'm asking here but if there is a better place let me know! )

-suppose you have a canvas with many items (rects, text, lines), how
can i empty the canvas?

-with a GridItem I can create a grid with both vertical and horizontal
lines; is it possible to create a grid with only vertical lines

Thank you!
Pier
___

Hi Pier.

Tried to Goocanvas list?, is the same for Pygoocanvas. I'll leave the
links if you're interested.

list: http://mail.gnome.org/mailman/listinfo/goocanvas-list

Archives : http://mail.gnome.org/archives/goocanvas-list/

Regards.

Cristian Abarzúa

___
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] Whait is PyGObject

2011-04-11 Thread craf
-Mensaje original-
De: jors worby...@gmail.com
Para: craf pyclut...@gmail.com
Cc: pygtk@daa.com.au
Asunto: Re: [pygtk] Whait is PyGObject
Fecha: Mon, 11 Apr 2011 10:21:05 +0200

El dom, 10-04-2011 a las 22:15 -0300, craf escribió:
 Hi everyone
 
 
 I am an enthusiastic new user of Pygtk and I have been some doubts about
 the new module PyGObject.
 In Pygtk I managed to make some simple programs for my personal use and
 I have to say I fell in love with its simplicity and beauty.
 
 My first question has to do with PyGObject. What is?, and how to replace
 Pygtk?

Some useful links to read:

About GObject Introspection: http://live.gnome.org/GObjectIntrospection
About PyGObject: http://live.gnome.org/PyGObject
Blurb explanation:
http://www.daa.com.au/pipermail/pygtk/2010-September/019019.html

Hi.

Thanks for the replies and links.

Best Regards

Cristian

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

[pygtk] Resize the control panel

2011-04-11 Thread craf
Hi.

I'm trying the paned widget and let me know how I can change the size of
its panels. I've tried the following code:

#!/usr/bin/env python

import gtk

class Pane:
def __init__(self):
window = gtk.Window()
window.set_default_size(400,400)
pane = gtk.HPaned()

pane.set_position(200)
label1 = gtk.Label(Label 1)
label2 = gtk.Label(Label 2)
pane.add1(label1)
pane.add2(label2)

window.connect(destroy, lambda w: gtk.main_quit())

window.add(pane)
window.show_all()
Pane()
gtk.main()

This code works, but if I get the instructions:

window.set_default_size(400,400)

and adding

window.maximize()

The method set_position () not working.

I tried to use pack() rather than add(), but I only managed to focus the
dicision between the two panels, using options resize and shrink).

What am I doing wrong?,I need to refresh the window when this is
maximized?

Thanks in advance.

Regards.

Cristian



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


[pygtk] Whait is PyGObject

2011-04-10 Thread craf
Hi everyone


I am an enthusiastic new user of Pygtk and I have been some doubts about
the new module PyGObject.
In Pygtk I managed to make some simple programs for my personal use and
I have to say I fell in love with its simplicity and beauty.

My first question has to do with PyGObject. What is?, and how to replace
Pygtk?


In Pygtk a simple code to create a window would be:

import gtk

window = gtk.Window()
window.show()
gtk.main()


This same code, how would in PyObject or no relationship?

My second question has to do with the shells of interface (Unity and
GNOME 3). Can I schedule for these managers Pygtk screen without
problems?.

Thanks in advance.

Regards.

Cristian


___
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: Understanding Pango+Cairo]

2010-11-23 Thread craf
Have you read this tutorial?
http://zetcode.com/tutorials/pygtktutorial/

Regards 

Cristian Abarzúa F

 De: Fabrice Delente delen...@gmail.com
 Para: pygtk@daa.com.au
 Asunto: [pygtk] Understanding Pango+Cairo
 Fecha: Tue, 23 Nov 2010 17:37:25 +0100
 
 Hello.
 
 I've been reading the doc to use both cairo to draw lines or arcs and
 pango to display text but I can't get to do it. The mix between the
 different contexts (cairo, pango, pangocairo) seems very complicated
 to me.
 
 Is there a tutorial or a hello world example somewhere? I haven't
 found anything clear through googling...
 
 Thanks!
 
 -- 
 Fabrice DELENTE
 ___
 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/

[pygtk] [Fwd: I want to make a example app with two thread and events]

2010-11-15 Thread craf
- Mensaje reenviado 
 De: MD or MD tres.14...@gmail.com
 Para: pygtk@daa.com.au
 Asunto: [pygtk] I want to make a example app with two thread and
 events
 Fecha: Mon, 15 Nov 2010 12:21:02 +0100
 
 Hi.
 
 I am a spanish programmer and I start with pyGtk.
 
 And I try to make a example that it is a simple window that blink a
 button with two colours, for test events and threads. But I don't know
 how to send custom event.
 
 This is the source code:
 
 import pygtk
 pygtk.require('2.0')
 import gtk
 
 import time
 import thread
 
 class test:
   def __init__(self):
   self.toggle = False
 
   self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
   self.window.set_title(Test)
   self.window.set_border_width(10)
   self.window.connect(destroy, self.destroy)
 
   #I want to
   #self.window.connect(custom_event, self.custom_event)
 
   self.button = gtk.Button(Button)
   self.button.connect(clicked, self.clicked, None)
 
   self.window.add(self.button)
 
   self.button.show()
   self.window.show()
 
   thread.start_new_thread(self.mThread, ())
 
 
   def destroy(self, widget, data=None):
   gtk.main_quit()
 
 
   def main(self):
   gtk.main()
 
 
   def clicked(self, widget, data):
   print Clicked event
 
 
   def custom_event(self, widget, data):
   if self.toggle:
   self.button.modify_bg(gtk.STATE_NORMAL, 
 gtk.gdk.Color(65535,0,0))
   else:
   self.button.modify_bg(gtk.STATE_NORMAL, 
 gtk.gdk.Color(0,65535,0))
 
 
   def mThread(self):
   while True:
   print Thread
   #self.emit('custom_event')
   time.sleep(5)
 
 
 
 if __name__ == __main__:
   test = test()
   test.main()
 
 
 Bye and thanks.


Hola.

Prueba con el evento focus.
Ej.

#I want to
#self.window.connect(focus, self.custom_event)

Saludos.

CRAF




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