Re: [pygtk] no invisible cursor

2005-03-01 Thread Ionutz Borcoman
John Finlay wrote:
Ionutz Borcoman wrote:
Hi,
The reference says:
To make the cursor invisible, use gtk.gdk.Cursor() to create a cursor
with no pixels in it.
When I try to use it, I get an error:
 import gtk
 gtk.pygtk_version
(2, 4, 1)
 c = gtk.gdk.Cursor()
Traceback (most recent call last):
  File stdin, line 1, in ?
TypeError: Usage:
  gtk.gdk.Cursor(cursor_type)
  gtk.gdk.Cursor(display, cursor_type)
  gtk.gdk.Cursor(display, pixbuf, x, y)
  gtk.gdk.Cusrsor(source, mask, fg, bg, x, y)

Any idea on what's wrong? Is this not supported in 2.4.1? Is it a bug?
TIA,
Try:
pix = gtk.gdk.Pixmap(window, 1, 1, 1)
color = gtk.gdk.Color()
cursor = gtk.gdk.Cursor(pix, pix, color, color, 0, 0)
John

Thanks, it should probably work, but I've already changed my code to:
def create_empty_cursor():
  pix_data = /* XPM */
static char * invisible_xpm[] = {
1 1 1 1,
   c None,
 };
  color = gtk.gdk.Color()
  pix = gtk.gdk.pixmap_create_from_data(None,
 pix_data, 1, 1, 1, color, color)
  return gtk.gdk.Cursor(pix, pix, color, color, 0, 0)
This way I don't need the window anymore and I can create the cursor
before showing the widget (in my __init__).
I guess this should go in the standard pygtk, that is, a call to
gtk.gdk.Cursor() with no arguments should return this cursor. As I said
before, I belive hiding the cursor is a common enough operation, so it
should deserve a simpler solution.
If not, your or my solution should go in the FAQ under How do I hide
the cursor?:
How do I hide the cursor?
-
1. Create an invisible cursor with:
  pix_data = /* XPM */
static char * invisible_xpm[] = {
1 1 1 1,
   c None,
 };
  color = gtk.gdk.Color()
  pix = gtk.gdk.pixmap_create_from_data(None,
 pix_data, 1, 1, 1, color, color)
  invisble_cursor = gtk.gdk.Cursor(pix, pix, color, color, 0, 0)
2. When you need to hide the cursor in 'some_gtk_widget', set it to the
invisble one:
  some_gtk_widget.window.set_cursor(invisble_cursor)
3. To show again the cursor, set it to the old cursor or to the default one:
  # set the cursor to the default one
  some_gtk_widget.window.set_cursor(None)
Cheers,
--
Ionutz Borcoman
http://borco.net/


signature.asc
Description: OpenPGP digital signature
___
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/


[pygtk] no invisible cursor

2005-02-28 Thread Ionutz Borcoman
Hi,
The reference says:
To make the cursor invisible, use gtk.gdk.Cursor() to create a cursor 
with no pixels in it.

When I try to use it, I get an error:
 import gtk
 gtk.pygtk_version
(2, 4, 1)
 c = gtk.gdk.Cursor()
Traceback (most recent call last):
  File stdin, line 1, in ?
TypeError: Usage:
  gtk.gdk.Cursor(cursor_type)
  gtk.gdk.Cursor(display, cursor_type)
  gtk.gdk.Cursor(display, pixbuf, x, y)
  gtk.gdk.Cusrsor(source, mask, fg, bg, x, y)

Any idea on what's wrong? Is this not supported in 2.4.1? Is it a bug?
TIA,
--
Ionutz Borcoman
http://borco.net/
___
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/


Re: [pygtk] no invisible cursor

2005-02-28 Thread Ionutz Borcoman
Le Boulanger Yann wrote:
Ionutz Borcoman wrote:
Le Boulanger Yann wrote:
Ionutz Borcoman wrote:
Hi,
The reference says:
To make the cursor invisible, use gtk.gdk.Cursor() to create a 
cursor with no pixels in it.

When I try to use it, I get an error:
  import gtk
  gtk.pygtk_version
(2, 4, 1)
  c = gtk.gdk.Cursor()
Traceback (most recent call last):
  File stdin, line 1, in ?
TypeError: Usage:
  gtk.gdk.Cursor(cursor_type)
  gtk.gdk.Cursor(display, cursor_type)
  gtk.gdk.Cursor(display, pixbuf, x, y)
  gtk.gdk.Cusrsor(source, mask, fg, bg, x, y)
 
Any idea on what's wrong? Is this not supported in 2.4.1? Is it a bug?
TIA,
Have a look here[1]. you'll find informations on the way to create a 
Cursor.

 1. http://pygtk.org/pygtk2reference/class-gdkcursor.html

Please read *more carefull* my post. I sent it because the stuff from 
[1] are not working. Or am I missing something?

TIA,
gtk.gdk.Cursor() constructor takes one or more arguments, you gave it 
none. it's the problem.

Yann
We are running in circles :/
Please read again the docs. They say you can use the gtk.gdk.Cursor() 
*with no arguments* to create an invisible cursor. The problem is that 
it is not working. So it is the problem of the docs or of the library.

So once again, how do I create an invisible cursor, because 
gtk.gdk.Cursor() *with no arguments* is not working, though this was the 
supposed way to do it, according to docs.

TIA,
--
Ionutz Borcoman
http://borco.net/
___
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/


Re: [pygtk] no invisible cursor

2005-02-28 Thread Le Boulanger Yann
Ionutz Borcoman wrote:
Le Boulanger Yann wrote:
Ionutz Borcoman wrote:
Le Boulanger Yann wrote:
Ionutz Borcoman wrote:
Hi,
The reference says:
To make the cursor invisible, use gtk.gdk.Cursor() to create a 
cursor with no pixels in it.

When I try to use it, I get an error:
  import gtk
  gtk.pygtk_version
(2, 4, 1)
  c = gtk.gdk.Cursor()
Traceback (most recent call last):
  File stdin, line 1, in ?
TypeError: Usage:
  gtk.gdk.Cursor(cursor_type)
  gtk.gdk.Cursor(display, cursor_type)
  gtk.gdk.Cursor(display, pixbuf, x, y)
  gtk.gdk.Cusrsor(source, mask, fg, bg, x, y)
 
Any idea on what's wrong? Is this not supported in 2.4.1? Is it a bug?
TIA,
Have a look here[1]. you'll find informations on the way to create a 
Cursor.

 1. http://pygtk.org/pygtk2reference/class-gdkcursor.html


Please read *more carefull* my post. I sent it because the stuff from 
[1] are not working. Or am I missing something?

TIA,
gtk.gdk.Cursor() constructor takes one or more arguments, you gave it 
none. it's the problem.

Yann

We are running in circles :/
Please read again the docs. They say you can use the gtk.gdk.Cursor() 
*with no arguments* to create an invisible cursor. The problem is that 
it is not working. So it is the problem of the docs or of the library.

So once again, how do I create an invisible cursor, because 
gtk.gdk.Cursor() *with no arguments* is not working, though this was the 
supposed way to do it, according to docs.

TIA,
I think the doc suggests you to use an empty pixbuf, not to run 
gtk.gdk.Cursors() without arguments.
Maybe i'm wrong :/

Yann
___
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/


Re: [pygtk] no invisible cursor

2005-02-28 Thread Ross Burton
On Mon, 2005-02-28 at 14:45 +0100, Le Boulanger Yann wrote:
 I think the doc suggests you to use an empty pixbuf, not to run 
 gtk.gdk.Cursors() without arguments.
 Maybe i'm wrong :/

That is correct.

By gtk.gdk.Cursor() the documentation meant one of the valid
gtk.gdk.Cursor constructors with an empty cursor.  This could probably
be phrased better.

Ross
-- 
Ross Burton mail: [EMAIL PROTECTED]
  jabber: [EMAIL PROTECTED]
 www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF



signature.asc
Description: This is a digitally signed message part
___
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/


Re: [pygtk] no invisible cursor

2005-02-28 Thread Ionutz Borcoman
Ross Burton wrote:
On Mon, 2005-02-28 at 14:45 +0100, Le Boulanger Yann wrote:
I think the doc suggests you to use an empty pixbuf, not to run 
gtk.gdk.Cursors() without arguments.
Maybe i'm wrong :/

That is correct.
By gtk.gdk.Cursor() the documentation meant one of the valid
gtk.gdk.Cursor constructors with an empty cursor.  This could probably
be phrased better.
Ross
I have try this:
def create_empty_cursor(window):
  pix_data = #define invisible_cursor_width 0
#define invisible_cursor_height 0
#define invisible_cursor_x_hot 0
#define invisible_cursor_y_hot 0
static unsigned short invisible_cursor_bits[] = {};
  color = gtk.gdk.Color()
  pix = gtk.gdk.bitmap_create_from_data(window, pix_data, 1, 1)
  return gtk.gdk.Cursor(pix, pix, color, color, 0, 0)
The problem is that I still get a black dot. I want nothing, not event 
that dot. (I have try to set the pix to have size 0x0, but it crashes 
the whole app).

I believe hiding the cursor is a common enough operation - there should 
be some shorcut for doing it. I though that gtkgdk.Cursor *with no 
arguments* is the way to do it. It looks now, it isn't :(

So, how do I hide the cursor?
TIA,
--
Ionutz Borcoman
http://borco.net/
___
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/


Re: [pygtk] no invisible cursor

2005-02-28 Thread Ross Burton
On Mon, 2005-02-28 at 17:08 +0200, Ionutz Borcoman wrote:
 The problem is that I still get a black dot. I want nothing, not event 
 that dot. (I have try to set the pix to have size 0x0, but it crashes 
 the whole app).
 
 I believe hiding the cursor is a common enough operation - there should 
 be some shorcut for doing it. I though that gtkgdk.Cursor *with no 
 arguments* is the way to do it. It looks now, it isn't :(

You'll need to set an empty mask for the cursor too.

Ross
-- 
Ross Burton mail: [EMAIL PROTECTED]
  jabber: [EMAIL PROTECTED]
 www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF



signature.asc
Description: This is a digitally signed message part
___
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/


Re: [pygtk] no invisible cursor

2005-02-28 Thread John Finlay
Ionutz Borcoman wrote:
Hi,
The reference says:
To make the cursor invisible, use gtk.gdk.Cursor() to create a cursor 
with no pixels in it.

When I try to use it, I get an error:
 import gtk
 gtk.pygtk_version
(2, 4, 1)
 c = gtk.gdk.Cursor()
Traceback (most recent call last):
  File stdin, line 1, in ?
TypeError: Usage:
  gtk.gdk.Cursor(cursor_type)
  gtk.gdk.Cursor(display, cursor_type)
  gtk.gdk.Cursor(display, pixbuf, x, y)
  gtk.gdk.Cusrsor(source, mask, fg, bg, x, y)

Any idea on what's wrong? Is this not supported in 2.4.1? Is it a bug?
TIA,
Try:
pix = gtk.gdk.Pixmap(window, 1, 1, 1)
color = gtk.gdk.Color()
cursor = gtk.gdk.Cursor(pix, pix, color, color, 0, 0)
John
___
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/