Re: [pygtk] Drawing on GTKImage

2008-02-03 Thread Donn
Sounds like you want to use cairo. Here's a link to a pyCairo tutorial/diagram/overview I created that might help you. There are also good examples on the cairo website under the cookbook. http://www.akaafrica.com/wiki_new/index.php/CairoTutorial:The_files_are_here \d Fonty Python and other

Re: [pygtk] Simple question on forcing a DrawingArea to be redrawn

2008-01-10 Thread Donn
I'm not sure this will help, but I use this code in a function I call when I want to force a redraw. It makes the expose event happen. self.alloc = self.get_allocation() rect = gtk.gdk.Rectangle(self.alloc.x, self.alloc.y, self.alloc.width, self.alloc.height) self.window.invalidate_rect(rect,

Re: [pygtk] window.invalidate_rect speed

2007-12-10 Thread Donn
Nathaniel, Thanks for your response. I will try to better explain: What do you mean by out of synch? Why is it so urgent that the redraw happen quickly? I mean that *if* the expose event takes too long to run, the loop may have begun again and the state of the app will have changed. I am

[pygtk] Expose event question - repeat

2007-12-10 Thread Donn
Hi, I am stuck on this and thought it may have been lost in the noise, or didn't reach the list. Can anyone give me a suggestion? repost: What do you mean by out of synch? Why is it so urgent that the redraw happen quickly? I mean that *if* the expose event takes too long to run, the loop

[pygtk] window.invalidate_rect speed

2007-12-09 Thread Donn
Hi, I have a timeout calling a function that handles my animation. Within that I have a call to _draw(): def _draw(): self.alloc = self.get_allocation() rect = gtk.gdk.Rectangle(self.alloc.x, self.alloc.y, self.alloc.width, self.alloc.height) self.window.invalidate_rect(rect, True) This

Re: [pygtk] pyGTK help subsystem?

2007-12-09 Thread Donn
Is there some generic format format that works on both windows and linux based systems? I'd stick to HTML. Write your pages in normal HTML with images etc Then experiment -- can you popup a browser? Perhaps you can find a way to display HTML pages in a GTK window - I know wxPython has that

Re: [pygtk] Saving treeview

2007-11-17 Thread Donn
Nice guys post their solution so that next searches on that topic won't bring answers like yours, which is equivalent to Hey guys, I know how to do it but I won't tell you. I was just thinking the same thing ;) /d ___ pygtk mailing list

Re: [pygtk] DrawingArea and mouse events

2007-11-12 Thread Donn
if your object can describe itself as a polygon, you can use a point in polygon test. matplotlib provides some code to do this which is extremely fast. Thanks. I solved this a few days ago. I understand the concept behind the point in poly (so clever!) but the implementation is a black box to

Re: [pygtk] DrawingArea and mouse events

2007-11-11 Thread Donn
If you want to implement yet another canvas (please don't) have a look at the source code of a good canvas and get inspiration (and code) from there. Well, the reason I asked in this list was to garner suggestions based on PyGTK. So far the canvases I've looked at are in C. But I'll take your

Re: [pygtk] DrawingArea and mouse events

2007-11-09 Thread Donn
What you're looking for is, for some reason or another, known as a canvas. Okay. It seems I am writing my own canvas then. I am stuck on GTL+2.8 for a bunch of reasons so I have not been able to run any of the popular canvas apps. People on the list might have suggestions for sorting

[pygtk] DrawingArea and mouse events

2007-11-08 Thread Donn
Hello, I have a rudimentary app going that draws cairo commands down onto a gtk.DrawingArea. On each loop they pile up, like so many pixels. I want to be able to bring life to each shape (rep by an object internally) such that they: * detect mouse enter/leave * detect mouse clicks * detect key

[pygtk] pycairo - translate question

2007-11-05 Thread Donn
Hi, not sure if this is the appropriate list. Can one, within a single cairo context, do this: while True: ctx.translate(0,0) pycairo commands to draw a square at 0,0 ctx.translate(10,10) pycairo commands to draw a circle at 0,0 ctx.translate(50,50) pycairo commands to draw a Black

[pygtk] Re: [cairo] pycairo - translate question

2007-11-05 Thread Donn
Yes, definitely the right list. Welcome, Donn! Thanks. Having fun so far! What you're looking for is save/restore, like so: Excellent. Saved! Often I will code all of my draw_something functions to also call save() at the beginning and restore() at the end, which helps them to act

[pygtk] Drawing SVG to a gtk.DrawingArea

2007-11-01 Thread Donn
Hi again, I have poked-around the net, but not found a simple example to: 1. Open an svg file 2. Draw it to a gtk.DrawingArea I am also confused about how that would/would not fit into pycairo - is cairo used to draw the svg, or is it done directly by something else? Is there any way to get

Re: [pygtk] Drawing SVG to a gtk.DrawingArea

2007-11-01 Thread Donn
To 'display' the SVG file in a gtk.DrawingArea is quite simple. Just use the Cairo source_pixbuf . So you are saying that an svg gets displayed as a bitmap of some kind? I checked your code and don't see anything to do with svg, but it's fill of clues. Thanks so far :) \d

Re: [pygtk] Relative mouse controlled game in gtk

2007-10-30 Thread Donn
for various reasons I want to migrate the whole thing over to an environment with better GUI support. I'm sure you know, but just in case -- there are some very cool gui's written to run directly in pygame. I can't remember the name, but one is particularly good. Ocemp or Ocean rings a bell.

[pygtk] gtk main loop alternatives

2007-10-28 Thread Donn
Hi, I want to try and draw a series of cairo shapes in a loop that does other stuff like: while True: canvas.draw() updateStuff() checkStuff() How do I fit this concept together with the gtk.main() that seems to stop there? Am I looking at some kind of timeout() command? \d

Re: [pygtk] gtk main loop alternatives

2007-10-28 Thread Donn
you have to do background work like this one, you need some kind of multithreading. Blimey. I have managed to get this far in life without ever looking at threads. I suppose it's high time ... Thanks for the link. \d ___ pygtk mailing list

Re: [pygtk] gtk main loop alternatives

2007-10-28 Thread Donn
That's not the only way. You can use gobject.timeout_add() to arrange for a function to be called at regular intervals. That function can then do whatever the body of your while loop would have done. Thanks again Greg, simplicity to the rescue :) \d

Re: [pygtk] widget containers for free placement

2007-10-27 Thread Donn
Greg, thanks for the feedback. This is a little long, so I hope you get the time to read it. I'll understand if you back quickly away from it and saunter off whistling :) I'm shooting for something seemingly impossible on Linux, and yet there are some tantalizing projects that approach it.

[pygtk] widget containers for free placement

2007-10-26 Thread Donn
Hello, I am *really* new to GTK and company and I am snowed-under by the bewildering array of classes. For example, I really can't figure out how to look for the classes I need, they all sort of look the same! I am reading the main tutorial, but the way I work is to aim for something: I want

Re: [pygtk] widget containers for free placement

2007-10-26 Thread Donn
You want a gtk.Layout. It lets you place widgets at explicit positions in a 32-bit coordinate system and can be scrolled. Thanks for the tip. I'm not getting closer. If you have a moment, could you look at this code? \d #!/usr/bin/env python import gtk import math class

Re: [pygtk] getattr confusion

2007-10-25 Thread Donn
Hey Abel! The difference is this: If property.name has the value 'foo', then getattr(self, property.name) is equivalent to getattr(self, 'foo'), Ah, I didn't spot that. Subtle. Thanks. /d -- If there is anyone in the audience who believes in telekinesis, please raise my hand! -- James Randi