Re: [pygtk] pygi - gtk drawingarea doesn't work?
On 07/13/2012 12:16 PM, Giuseppe Penone wrote: Hi, running the demo http://git.gnome.org/browse/pygobject/tree/examples/cairo-demo.py about the drawing area produces on my lubuntu 12.04 an empty window. the 'draw' event is never called, is this a bug? That demo works fine on my Ubuntu 12.04 box, and my Lubuntu 11.10 box. 'draw' should get called when the window is first exposed, and again any time the window is damaged. You have python-gobject installed, right? -- David Riptondrip...@ripton.net ___ 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@daa.com.au
On 06/19/2012 08:35 PM, Alice Marcot wrote: I have a gtk window; a vbox; and I append an image to the vbox. I am trying to catch mouse click event from the image, but no response. I can catch mouse click from the window object. Images can't catch events. You need to put the Image inside an EventBox. -- David Riptondrip...@ripton.net ___ 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] [jeenuv.otherinbox.com] Re: Drawing and signals
On 2010.06.10 19:46:51 +0530, Jeenu V wrote: On Thu, Jun 10, 2010 at 4:59 AM, John Stowers john.stowers.li...@gmail.com wrote: If you are looking for general drawing, click handling, etc then it sounds like you should use a canvas. Check out goocanvas (and its python bindings - http://live.gnome.org/PyGoocanvas) Interesting. I was thinking of a cross-platform (between Windows/Cygwin and Linux) and this one doesn't seem to have a ready-made Windows binary. More over couldn't get that compiled in Linux either. However, please edify me: can I use PyCairo alone for all my drawings and signal handling? I get the feeling that Cairo lies beneath all of the packages suggested by folks. I couldn't get a documentation reference for PyCairo (or didn't I search enough?) Yes, of course you can just use PyCairo rather than a canvas. It's just more work that way. I ended up having to go this route at work because we're stuck on RHEL 5 which has ancient versions of GTK+ and Cairo, and all the nice new canvases I tried require newer versions. Last time I checked there were no API docs for PyCairo. There are a couple of simple tutorials for it, and then there are the C API docs for Cairo. Follow the Python tutorials to learn the basics, and then learn how to translate the C API docs to Python. It's annoying to have to do that, but not really difficult. If you're unhappy with that situation then please contribute some PyCairo docs. -- David Riptondrip...@ripton.net ___ 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] [jeenuv.otherinbox.com] Re: [jeenuv.otherinbox.com] Re: Drawing and signals
On 2010.06.10 22:44:40 +0530, Jeenu V wrote: On Thu, Jun 10, 2010 at 8:23 PM, David Ripton drip...@ripton.net wrote: Yes, of course you can just use PyCairo rather than a canvas. It's just more work that way. I ended up having to go this route at work because we're stuck on RHEL 5 which has ancient versions of GTK+ and Cairo, and all the nice new canvases I tried require newer versions. Alright. If you've anything that can be shared about how you took the long(er) route, please consider doing so. Cairo is basically immediate mode. Which means you need to redraw everything in the exposed area every time. A canvas is retained mode. Meaning you build some objects that know how to redraw themselves every time they are exposed, with support for placing them and possibly overlapping them and only drawing what's on top. If your drawing is simple enough then it's easier to just use Cairo; the more objects you throw onto the screen, the more sense it makes to use a full canvas to subdivide the work so you don't end up with a gigantic unmaintainable draw method. I needed a canvas that would work well with the old versions of libraries on RHEL 5 and not have license problems, and couldn't find one (GnomeCanvas didn't let me rescale things well, GooCanvas didn't work well for me for some reason I've forgotten and was also a pain to build, the one from OLPC was GPL licensed), so I wrote my own. Basically inherits from DrawingArea and does Cairo calls in the draw methods. The canvas is only 850 lines of Python, but it's the kind of fiddly lower-level GUI code that's a pain to write. There are classes for rectangles, lines with arrows on the ends of them (which require some trig to draw correctly), SVG images (rsvg module), text (pango and pangocairo). A general-purpose canvas library would have more stuff, but that's all I needed. Performance is fine for a small number of displayed objects but doesn't scale well to hundreds of objects. I'd like to obsolete this code when we can switch to RHEL 6. I highly recommend reusing one of the existing canvases rather than writing your own if at all possible. -- David Riptondrip...@ripton.net ___ 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] OSX support for end users?
On 2010.06.01 08:06:53 -0400, Matthew Beckler wrote: I've looked through the mailing list archives and around the web, but wanted to confirm my doubts here. If I write a pygtk program, can a user easily install everything necessary to run my program on OSX? No, not easily. It's too hard for most users to install multiple dependencies. You need to bundle everything together for them using something like py2app. -- David Riptondrip...@ripton.net ___ 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.glade import problem
On 2010.04.30 16:28:07 +0200, Krisztian Buza wrote: I am new with Python. I have installed Python (version 2.6), PyGTK and Glade (http://ftp.gnome.org/pub/GNOME/binaries/win32/glade3/) under Windows. The import pygtk command works nice (i.e. without error message), but import pygtk.glade does not seem to work: I get this error message: No module named glade. The canonical incantation is: import pygtk pygtk.require(2.0) import gtk import gtk.glade -- David Riptondrip...@ripton.net ___ 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] Drawing on a gdk.Pixbuf using Cairo.
On 2010.03.02 10:59:05 +0100, Osmo Maatta wrote: I have a program that needs to draw circles and other elements on a gdk.Pixbuf image. The current code works well but when creating a Cairo-surface from pixbuf, the gtk.gdk.Pixbuf.get_pixels_array() function reports that it's deprecated and should be avoided. 1) What is the best way to draw onto gdk.Pixbuf? (most likely using Cairo, other means also welcomed) I think Cairo is the best way. I used to use PIL, but switching to Cairo let me remove a dependency, and use the same API for drawing to the screen and drawing to image files. 2) If the gtk.gdk.Pixbuf.get_pixels_array() or its internals are deprecated, then what will replace it? I don't see a direct replacement. One way to do it is Pixbuf.save() to a PNG, then cairo.ImageSurface.create_from_png(). I don't know if that's significantly less efficient than Pixbuf.get_pixels_array(). It does avoid depending on NumPy. There might be useful information about this in the version control logs or bug tracker, if you're willing to dig for it. -- David Riptondrip...@ripton.net ___ 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] Saving and reading images from database
On 2009.11.13 15:15:22 +0100, Timo List wrote: My program uses the SQLite database. The database holds some information about persons and I want to add a picture for each person. Not the path to the file, but the actual image so that the image also works if the file is deleted on the harddisk. I can save the image in a BLOB column as: imgfile = open('/path/to/image.png') db.save_image(imgfile.read()) Works fine as far as I see. (Maybe any comments on this?) Retrieving also works, but I see no possibility to show this image in a gtk.Image widget. I can't seem to find anything related to this on the net, maybe someone reading this has done this before? Have you already tried gtk.gdk.PixbufLoader? Of course, if all else fails, you can always write the blob out to a tempfile and then use gtk.gdk.pixbuf_new_from_file on the tempfile. -- David Riptondrip...@ripton.net ___ 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] Pixmap save/load
On 2009.10.08 21:07:10 +0100, Peyman wrote: I am generating a pictures that requires O(n^2) time so I create it as a pixmap, that way I don't have to keep generating it. I can then save this as a JPEG via pixbuf. But is there any way to load that jpeg again, for example the next time I load the program? http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html#function-gdk--pixbuf-new-from-file -- David Riptondrip...@ripton.net ___ 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 + Cairo + PNG file in the background
On 2009.09.11 18:10:02 +0200, Fabrice DELENTE wrote: I'm trying to develop a small app to do the following: I'd like to have a PNG file loaded in the background, rescaled to the width of my window, with a vertical scroller; I want to be able to click on the PNG and type text at the point where I clicked. I intend to use pangocairo to type the text, and cairo to render the PNG file; however I have trouble to find any leads on how to display a PNG file in with cairo (I'm getting mixed up between contexts and surfaces: what is the difference?) A surface is a thing you draw on. A context holds the cairo-specific state related to drawing on a single surface. Here are a couple of lines to get you started: surface = cairo.ImageSurface.create_from_png(path) ctx = cairo.Context(surface) -- David Riptondrip...@ripton.net ___ 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] Takes two Ctl-C to kill?
On 2009.07.15 09:49:01 -0500, s...@pobox.com wrote: We have an admittedly odd setup at work, but I thought I'd ask here first... If you have a multithreaded PyGtk application and kill it with Ctl-C does it require one or two Ctl-C's to do the deed? We are seeing two (using pygtk 2.12). I sort of assume we are doing something wrong, swallowing the first exception somehow or unwinding some inner frame. The next Ctl-C kills the app. We're not really concerned with trapping Ctl-C but with other more important exceptions being silently ignored. Also seeing two here. Only during the part of the program's run when two threads are active. When only one thread is active, it exits with a single ctrl-C. CentOS 5.3, PyGTK 2.10.4 -- David Riptondrip...@ripton.net ___ 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] Socket listening
On 2009.05.05 13:39:51 +0200, Maxime Ripard wrote: I am new to pyGTK, and I have few problems writing a GUI for an existing program. One of the purpose of the program is to set up BOOTP and TFTP servers, to allow a PXE boot. Both servers are in different threads than the program itself. If was formerly using a cli, and everything was going fine. I now want to use a GUI, so I decided to use pyGTK and Glade. All the behaviour of my program is wrapped in a class, instanciated by both interfaces, in the same way. But with the GUI, everything is fine, the servers are launched and listen properly, except that nothing seems to come to them. I have read somewhere that when you need to listen on sockets while running the event loop, you have to use gtk.input_add(), but what if the sockets aren't in the same thread ? Do I have to use it anyway ? Launching the cli using subprocess.Popen within the GUI handlers makes it work, but it is kind of dirty to me, and not really what I want ... Is there any solution ? The combination of PyGTK and threads is problematic. It works if you follow all the rules but not always cleanly / easily / portably. I've been disappointed with io_add_watch and friends. The API seems to include everything you need, but it doesn't always work cleanly / easily / portably. When I need to combine PyGTK and non-trivial networking, I use Twisted. The main loops integrate seamlessly (using gtk2reactor) and then I use Twisted APIs for networking and scheduling and PyGTK's APIs for the GUI and it all works. But of course that may be a much bigger change than you want. -- David Riptondrip...@ripton.net ___ 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] ImportError: DLL load failed
On 2009.02.23 20:32:22 +0100, Martin Walser wrote: I just upgraded from Python 2.5 to Python 2.6 on my Windows machine. But. unfortunately I can't get PyGTK to run anymore. 1. Built Python 2.6 myself. I also did the necessary registry entries, so setup of pygtk etc. finds the Py dir 2. gtk-dev-2.12.9-win32-2.exe . installed to: c:\libs\GTK installiert 3. pygtk-2.12.1-3.win32-py2.6.exe . installed in new python dir 4. pycairo-1.4.12-2.win32-py2.6.exe . installed in new python dir 5. pygobject-2.14.2-2.win32-py2.6.exe . installed in new python dir But when I try to run my application, Python gives me: ImportError: DLL load failed: The specified module could not be found. Wondering which DLL is missing I checked the _gobject with dependency walker. Looks like MSVCR90.dll is missing. I didn't wonder much, as I'm still using VS 2005. But installing the VS2008 and VS2008+SP1 redists didn't help. Copying either of the dlls of the VS2008 redist package aside the _gobject.pyd result in a crash only: wrong dll. Am I on the completely wrong trip anyway seeking the problem with a missing MSVCR90.dll? I'm not a Windows person, but I know that the new default compiler for Python 2.6 on Windows is VS 2008. And I believe that mixing Python compiled with one compiler with extension modules compiled with another (significantly different) compiler doesn't work. So I believe the reasonable options are: * use only precompiled binaries, all built on VS 2008 * build everything yourself, so it all uses your VS 2005 * upgrade to VS 2008 so that things you build are compatible with other people's precompiled binaries and you're free to mix and match * go back to Python 2.5 * switch to another OS (the same kinds of version problems exist, but people care less when upgrading the compiler is free) -- David Riptondrip...@ripton.net ___ 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] Help/Advice iwth install/setup issue?
On 2009.02.05 10:59:31 -0800, Ian Peters-Campbell wrote: When I set up my CentOS 5 system it had Python 2.4. I upgrades to Python 2.5 in order to run Buildbot. Unfortunately I am running into a problem where Buildbot is calling to Zope, which is in turn attempting to import gobject, which fails. If I start my Python2.4 interpreter I can import gobject fine. I tried installing pygobject 2.16.0 from source, but it failed to configure saying it could not find glib 2.14.0. Not surprising since CentOS still ships 2.12 config.log, about 2/3 through, says 'glib_major_version' undeclared, and the error seems to repeat for minor and micro. I downloaded glib 2.18.4 and attempted to install that from source, whih went off without a hitch. Returning and attempting to install pygobject 2.16.0 and I get the same error, with it claiming that it is unable to find glib 2.14 and with the same errors in the log. It found the old one instead of the one you just installed. I am sure there is something simple I am doing wrong, but my Linux-Fu is a little rusty. Can anyone point me in the right direction for getting Python 2.5 to find and use gobject? I see two paths to victory. One is finding the magic configure option to tell configure exactly which glib to use. This will probably be something short and obvious-in-hindsight like --glib=/usr/local/lib/libglib-2.0.so, but since configure --help doesn't actually tell you all the options, it may require digging around. The other is installing an older version of pygobject, which is compatible with glib 2.12. Then finding the platform glib will be fine. The Python libraries for the platform Python 2.4 (/usr/lib/python2.4) and for your Python 2.5 (probably /usr/local/lib/python2.5) are completely independent. You have to install everything again for 2.5. But if you don't actually need features or bugfixes from the newer version of a Python library, it's easier to use the same old version that CentOS uses, because you know all its C library prerequisities are already installed. -- David Riptondrip...@ripton.net ___ 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] Layout of complex app
On 2009.01.28 13:02:39 +0100, Thomas Guettler wrote: what layout (directories and classes) do you use for a pygtk project? I am programming since several years, but I am not used to event based programming like pygtk. The pygtk tutorial suggest this: {{{ class HelloWorld: def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) ... self.show() def main(self): gtk.main() if __name__ == __main__: hello = HelloWorld() hello.main() }}} If you start other dialogs from HelloWorld, which depend on data stored in the main object, do you pass it around, or do you store it in a global variable at module level? I pass it around. I don't use globals in non-trivial code that also has classes, because once you've gone to the bother to use classes then instance variables are about as easy to use as globals, and cleaner. So If I have widget A that depends on widgets B and C, I add B and C as instance variables inside A. When possible I set them exactly once in A.__init__, to simplify lifespan issues and make the code easier to read. Note that the HelloWorld class above encapsulates a gtk.Window rather than inheriting from gtk.Window. I think this is usually right, because you often want code in your class that's not part of the parent widget's mission, so has-a makes more sense than is-a. And it's easier with Glade to have not-widget classes that encapsulate stock widget classes, than to have custom-widget classes, because that way you don't have to write custom loading code. I only subclass gtk widgets when I actually need a custom widget that does its own drawing, which usually means a gtk.DrawingArea subclass. As far as packages / directories go, my personal preference is to keep it as simple as possible until it actually needs to be complex. That means that I start with one directory and put all the files there, use sibling imports rather than package imports, run the code straight out of the source tree rather than installing it, etc. When the project actually gets big enough that one directory gets unwieldy, then I move files into subdirectories. When it's ready to deliver to endusers, then I make an installer and do proper packages. IMO it's easier that way, and modern version control systems don't punish moving files around like CVS did. -- David Riptondrip...@ripton.net ___ 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] cairo speed
On 2008.12.03 11:34:00 +0100, Frédéric wrote: I'm using the basic drawing functions of a DrawingArea, and I was wondering if using cairo module would speed up things? I can draw a lot of rectangles (from 10 to 500), for which I change colors, and the refresh takes some time on Nokia/maemo plateform. Do you think cairo will be better here? Yes. I just tested it, and Cairo was significantly faster on my box. (About 0.03s vs. 0.13s on average. YMMV.) My test program is here: http://ripton.net/blog/?p=32 -- David Ripton[EMAIL PROTECTED] ___ 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] Threads sync
On 2008.11.22 11:28:22 +0100, Frédéric wrote: I have some troubles with threads in my Papywizard app. During the shooting process, I launch a thread which iterates over all shooting positions, and control the hardware to move the panoramic head, and trigger the camera. Right after this thread is launch, I periodically execute a function from the GTK lop, using gobject.timeout_add(). In this function, I read some variables of the external thread to refresh the GUI. The user can also interact with the GUI during the shooting process, to pause/stop it. All works fine on my PC (running linux), but I experience several problems on maemo. For example, some part of the GUI are not correctly refreshed the first time I launch the shooting process. If I stop it, and retry, all works fine. Another issue is that I can send user action at wrong moments. I think this a related to the lower speed execution of the application, showing me some wrong-codeed things in my app. So I need to add some robust inter-threads sync mecanisms, to ensure I can't trigger actions at the wrong place. I tried to use the Event object from the standard threading module, but it does not work under maemo (while it works fine on the PC) :o( If threading.Event doesn't work on maemo, I worry about whether the other basic locking primitives are broken too. Try running test_thread.py and test_threading.py from the Python source tree. If basic locks are broken then threads are completely unsafe, and you'll need to either fix them or use a different concurrency model. So, what other mecanism should I use to sync my threads? Is there a GTK-based macanism? Assuming threading.Lock works on maemo, I suggest Queue.Queue, from the Python standard library. The idea is that you don't share mutable objects across threads. Instead, you pass safe messages composed of tuples of immutable value objects (strings, ints, etc.) across queues. Then your threads can't corrupt each other's mutable data because they can't even see each other's mutable data. And you won't get deadlocks because you're not using lots of locks, just one per queue, which is inside proven library code. And you can't read data at a bad time (like in between updating x and y of the camera's position coordinates) because the other thread knows when to safely put its data onto the queue. In your case I think you'd want two queues, one carrying commands from the GUI thread to the external thread (e.g. (move_camera, 3, 4, 5)) and one carrying status the other way (e.g. (flashed, Bulb3, 1227370225.247529)). And then each side has a loop that periodically does a non-blocking read from the appropriate queue and takes the appropriate action if it finds something there. -- David Ripton[EMAIL PROTECTED] ___ 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.Image write text inside Image
On 2008.11.07 15:21:29 +, Luis Gonzalez wrote: I have a gtk.Image load from file. I want to write text inside this Image and then write to a file (jpg or png). I try to do use gtk.gdk.Pixbuf but to write text , draw lines , draw rectangle I need a drawable object like gtk.gdk.Pixmap. How can i do this? The last time I needed to do this (in 2005), I had problems with PyGTK's image manipulation abilities / API / docs, and ended up using Python Imaging Library from inside my PyGTK program. I have some code PyGTK + PIL code that you can look at here: http://slugathon.python-hosting.com/file/trunk/slugathon/Chit.py It loads a base image from a PNG file into PIL, then uses PIL to draw lines and text on it, then takes the final image and saves it to a file format that PyGTK understands (via a StringIO, though you could use a real file instead), so that PyGTK can load it into a pixbuf. PyGTK gets better every release, and its docs have improved too, so maybe it's no longer necessary to resort to PIL. But it's an option to consider. -- David Ripton[EMAIL PROTECTED] ___ 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] python 2.6 compatibility
On 2008.10.19 14:19:23 -0700, Newell Jensen wrote: Does anyone know when and if pygtk will become compatible with the new release of python 2.6? I haven't looked at the all the source code for pygtk but here are instances where it would break: http://docs.python.org/whatsnew/2.6.html#porting-to-python-2-6 Before taking the time to devel into this I wanted to see if someone already knew the answer to this. For what it's worth, I'm successfully using PyGTK 2.12.1 under Python 2.6, on a Gentoo Linux box. My program doesn't exercise every single dark corner of PyGTK, so I can't conclusively claim that there are no compatibility bugs to stomp, but I've been looking for problems and haven't seen any. 2.6 seems very compatible with 2.5. The main difference I've seen is lots of warnings from code that uses newly deprecated modules, in particular md5 and sha. -- David Ripton[EMAIL PROTECTED] ___ 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] Checking version of PyGTK from withing Python
On 2008.05.19 11:34:27 -0700, Mitko Haralanov wrote: Is there a way to check the version of PyGTK from within my Python program? I know of pygtk.require() but that returns False for anything higher then 2.0, even though I have pygtk-2.12 installed. $ python import gtk [x for x in dir(gtk) if ver in x] ['check_version', 'gtk_version', 'pygtk_version', 'ver'] gtk.gtk_version (2, 10, 4) gtk.pygtk_version (2, 10, 1) gtk.ver (2, 12, 1) -- David Ripton[EMAIL PROTECTED] ___ 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] Checking version of PyGTK from withing Python
On 2008.05.19 14:04:25 -0700, Mitko Haralanov wrote: On Mon, 19 May 2008 13:20:23 -0700 David Ripton [EMAIL PROTECTED] wrote: $ python [...] ['check_version', 'gtk_version', 'pygtk_version', 'ver'] [...] (2, 10, 4) [...] (2, 10, 1) [...] (2, 12, 1) I am sorry but your reply is not very useful. Are those methods of a module? Defined constants? I can't find them defined anywhere Maybe Python's interactive prompt looked too much like an email reply, and confused your mail client? Sorry. Anyway, I was trying to demonstrate how to dig around in Python modules looking for symbols, when you can't find something in the docs. Once you know the name of the symbol, then you can more easily find the details. (I didn't actually know the answer to your question, but I found it in a few seconds with the Python interactive prompt, using the dir() function and a guess that the version information would be found in something with version in its name.) Anyway, the version constants I found are documented here: http://www.pygtk.org/docs/pygtk/gtk-constants.html#gtk-version-constants And the function I found is documented here: http://www.pygtk.org/docs/pygtk/gtk-functions.html#function-gtk--check-version -- David Ripton[EMAIL PROTECTED] ___ 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] subclassing gtk.Bin
On 2005.11.10 18:57:42 -0500, spike grobstein wrote: actually,I thought I had pygtk 2.8, but apparently I only have 2.6.1... gentoo hasn't upgraded the pygtk package to 2.8 yet. I'm gonna have to do it manually, I guess. Gentoo has pygtk 2.8.2, in ~x86. -- David Ripton[EMAIL PROTECTED] ___ 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] calling a program from a program
On 2005.11.09 08:18:58 -0600, nephish wrote: i have a program that calls another program to execute on a button click. Its another pygtk app. And i am using the os.system('python /home/my/myprogram.py') to bring it up. It comes up ok, but when i close its window, the program that called it up is locked up. Um, what could i do about this? Is the child program actually exiting when you close its window, or just hiding the window? os.system will block the parent program until the child program actually exits. If you want the parent program to freeze until the child exits, then resume, then you probably just need to make the child actually terminate (with sys.exit) when you close its main window. If you want the parent to stay responsive while the child runs, then you probably want to launch the child program in the background (see the docs for the subprocess module). Another option would be creating a second thread in the main program and spawning the child program from it, so the main thread can keep processing events. -- David Ripton[EMAIL PROTECTED] ___ 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] trying to launch a pygame app from within my gtk app
On 2005.11.09 11:55:32 -0700, Chris Irish wrote: Does anyone have experience launching a executeable on a windows box from within there GTK app? I made a GUI app with pyGTK that I want to be able to launch a game I've downloaded from the pygame website when a button is clicked. I was able to do this on a linux box since the file was a .py file, but I'm not sure how to do it on a windows box since the game's file is an executeable for windows. On linux I did this: import os olddir = os.getcwd() #to keep a reference to the old directory to switch games later os.chdir('spacinVaders-0.1') #switch to the game's directory os.spawnlp(os.P_NOWAIT, 'pythonw', 'pythonw', 'play.py') and it would launch fine can someone help me with this?? but i can't get it to work if i do something like os.spawnlp(os.P_NOWAIT, 'pythonw', 'pythonw', 'play.exe') Can you only run python scripts from a python program? Or am I missing something? os.spawnlp doesn't work on Windows. You need to use one of the other spawn variants. See http://docs.python.org/lib/os-process.html And you probably need to run pythonw.exe, not just pythonw. (And maybe with a full path, if your Python directory is not in the PATH.) -- David Ripton[EMAIL PROTECTED] ___ 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] Threading on win32
On 2005.04.18 14:31:09 +, Dave Aitel wrote: Danny Milosavljevic wrote: What is module timeoutsocket ? Timeoutsock is a commonly used Python module that allows TCP sockets to have a timeout on various operations. http://www.steffensiebert.de/soft/python/timeoutsocket.py Note that the version of the socket module included in Python 2.3+ includes the ability to use timeouts on both http (like timeoutsocket) and https (unlike timeoutsocket) connections. So, unless you're stuck on Python 2.2, there's no real need for timeoutsocket anymore. -- David Ripton[EMAIL PROTECTED] ___ 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] List replies go to OP
On 2004.03.11 23:43:43 +, Alexandre Strube wrote: When we reply a message from this list, the default behaviour is to reply to the author, not back to list. Wouldn't be better to keep replies to the list? No. Here's the canonical list of reasons. http://www.unicom.com/pw/reply-to-harmful.html -- David Ripton[EMAIL PROTECTED] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/