Re: [pygtk] PyGTK, Win32 and py2exe: no luck
At 06:17 PM 9/3/2003 -0400, Charles Lepple wrote: I am trying to bundle up a GTK+2 app on Win32 which uses PyGTK (from Cedric's pygtk installer). I have tried py2exe, cx_Freeze, and Gordon McMillan's Installer, but I can't seem to make a working standalone .exe file with any of them. Since the PyGTK FAQ says that you can do this with py2exe, I'll just focus on that attempt for now. I get a whole bunch of messages and py2exe creates an .exe file. When I run it, I get this error: Traceback (most recent call last): File "", line 17, in ? File "pygtk.pyc", line 73, in require AssertionError: required version '2.0' not found on system ... which is probably a result of calling pygtk.require('2.0'). Right, py2exe does not like it, as your final executable does not know what sys.path and sys.modules contain. Just get rid of it and it should work. At least py2exe works for me on the glade example (glade-demo.py). Just make sure that py2exe does not include the GTK+ DLLs (except libglade-2.0.dll and libxml2.dll) and ask your final users to install the dropline GTK+ distribution instead. Cedric ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] timeout_add questions
Hello and thank you very much for mentioned the timeout_add I want to have a screen that pops up (splash or dialog) and counts down for a certain period and then dissapears The follow code is starting to do something of that I want but when the splash page pops up it doesnt update the range. Here is the code Again all help is very appreciated #!/usr/bin/python2.2 import pygtk pygtk.require('2.0') import gtk class Splash: def __init__(self): self.window = gtk.Window() self.window.set_title("SPLASH") self.labelCount = gtk.Label() self.labelCount.show() self.window.add(self.labelCount) gtk.timeout_add(2000, self.window.show) for x in range(1): self.labelCount.set_text("%s" %x) gtk.timeout_add(5000, self.window.hide) class Window: def main(self): gtk.main() def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_title("Pay Raintree") self.window.set_border_width(10) self.window.show() #MAIN VERTICAL BOX self.VboxMain = gtk.VBox(gtk.FALSE,0) self.VboxMain.show() self.window.add(self.VboxMain) self.window.set_border_width(20) #First Horizontal Box self.Hbox1 = gtk.HBox(gtk.FALSE,0) self.Hbox1.show() self.VboxMain.pack_start(self.Hbox1) #Label self.mainLabel = gtk.Label("USER INFO") self.mainLabel.show() self.Hbox1.pack_start(self.mainLabel, gtk.TRUE, gtk.TRUE,0) #add QUIT BUTTON self.quitButton = gtk.Button("QUIT") self.quitButton.connect("clicked", self.quit) self.quitButton.show() self.Hbox1.pack_start(self.quitButton, gtk.TRUE, gtk.TRUE,0) def quit(self,widget, data = None): gtk.main_quit() window = Window() splash = Splash() #gtk.timeout_add(2000,splash.window.show) #gtk.timeout_add(5000, splash.window.hide) #Unclear that gtk.idle_add is doing here #gtk.idle_add(window.main()) window.main() __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Can anyone do a status on OSX + PyGTK?
Scott Prive said: > >I am using PyGTK2 on Windows and Linux. Has anyone built a package for OS/X? > >I understand from a few weeks ago's threads that there were issues >building under OS/X, but they should/might be cleared up now. Is >there perhaps an un-official or experimental fink package? I places a set of pygtk2 packages in Fink's unstable on August 13. It's based on pygtk-1.99.17 (I'll move it to 2.0.0 next week) and is available for python 2.2 and 2.3 (NB: the -py22 is untested). Let me (or the usual Fink help channels) know if you have any trouble getting it installed. dan -- Daniel Macks [EMAIL PROTECTED] http://www.netspace.org/~dmacks ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] PyGTK, Win32 and py2exe: no luck
I am trying to bundle up a GTK+2 app on Win32 which uses PyGTK (from Cedric's pygtk installer). I have tried py2exe, cx_Freeze, and Gordon McMillan's Installer, but I can't seem to make a working standalone .exe file with any of them. Since the PyGTK FAQ says that you can do this with py2exe, I'll just focus on that attempt for now. I get a whole bunch of messages and py2exe creates an .exe file. When I run it, I get this error: Traceback (most recent call last): File "", line 17, in ? File "pygtk.pyc", line 73, in require AssertionError: required version '2.0' not found on system ... which is probably a result of calling pygtk.require('2.0'). Here's my setup.py: # setup.py from distutils.core import setup import glob try: import py2exe except: import sys sys.stderr.write("You need py2exe.\n") import gtk_path dlls=[gtk_path.gtkdir[0] + '\\lib\\libglib-2.0-0.dll'] setup(name="posgui", version="0.0.1", scripts=["posgui.pyw"], data_files=[(".", ["posgui.glade"]), (".", dlls)], ) And here's setup.cfg: [py2exe] includes=pango,atk,gtk (Adding the 'gtk' module in 'includes' doesn't seem to have an effect) I do get the following warning: warning: py2exe: * The following modules were not found: warning: py2exe: * FCNTL warning: py2exe: * gdk warning: py2exe: * javax.comm warning: py2exe: * ltihooks but I can't figure out how to resolve the gdk one, and I'm not using the other modules directly. Here are some relevant version numbers: Python: 2.3 py2exe: 0.4.1 and 0.4.2 (same results) GTK: GTK-Runtime-Environment-2.2.1.2.exe (from dropline) pygtk: 1.99.17 Any suggestions? thanks, -- Charles Lepple <[EMAIL PROTECTED]> http://www.ghz.cc/charles/ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Creating custom CellRenderer
Hi, > The immedate problem is that layout.set_width() apparently expects > something other than pixels. If I do layout.set_width(20), > get_pixel_size() will return a width of 195 pixels. I couldn't find > anything in the documentation about the units set_width() expects or > how to convert number of pixels to it. > Where is this documented, and how could I handle the conversion? The factor is pango.SCALE, and you can use pango.PIXELS(layout_space) to convert (or just divide). No clue about your other question, though. Iñaki ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Creating custom CellRenderer
Hi! As a beginner pygtk user, I'm trying to make a TreeView which has multi-line cells. Each node would contain about 1-4 lines of text. If I were to use a gtk.CellRendererText, only 1 line would be visible, and the user would have to scroll horizontally to see the rest of the text. I want the full text to be visible, by having it wrap if it is more than one line. The best solution would be using a TextView as a CellRenderer. But it looks like normal widgets can't be used like that. (Is there a reason for this? One would think that CellRenderers would be very similar to normal widgets.) So I guess my best bet is making a custom CellRenderer. I thought something like this would work: ---8< import pygtk pygtk.require('2.0') import gtk import gobject import pango class MyCellRenderer(gtk.GenericCellRenderer): def __init__(self): self.__gobject_init__() def on_render(self, window, widget, background_area, cell_area, expose_area, flags): context = widget.get_pango_context() layout = pango.Layout(context) layout.set_text(long_string) layout.set_wrap(gtk.WRAP_CHAR) layout.set_width(cell_area.width) widget.style.paint_layout(window, gtk.STATE_NORMAL, gtk.TRUE, cell_area, widget, 'footext', cell_area.x, cell_area.y, layout) def on_get_size(self, widget, cell_area): return 0,0,100,100 # return something big enough gobject.type_register(MyCellRenderer) class Tree(gtk.TreeView): def __init__(self): self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) gtk.TreeView.__init__(self) self.set_size_request(300, 200) self.set_model(self.store) self.set_headers_visible(gtk.TRUE) rend = gtk.CellRendererText() column = gtk.TreeViewColumn('First', rend, text=0) self.append_column(column) rend = MyCellRenderer() column = gtk.TreeViewColumn('Second', rend) self.append_column(column) def insert(self, name): iter = self.store.append() self.store.set(iter, 0, name) long_string="""long-long string for testing asdf asdf asdf asdf adsf asdf asdf asdasdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf """ w = gtk.Window() w.set_position(gtk.WIN_POS_CENTER) w.connect('delete-event', gtk.mainquit) t = Tree() t.insert('baz') w.add(t) w.show_all() gtk.main() ---8<--- The immedate problem is that layout.set_width() apparently expects something other than pixels. If I do layout.set_width(20), get_pixel_size() will return a width of 195 pixels. I couldn't find anything in the documentation about the units set_width() expects or how to convert number of pixels to it. Where is this documented, and how could I handle the conversion? Even if I somehow manage to convert pixels to this unit system, I will have another problem: I want the width of the text to adjust to the width of the TreeView widget. The height of the text should adjust to the amount of text in that given node. The problem is, that as I understand it, the CellRenderer has to calculate the size needed in on_get_size(). But I couldn't find a way to get the size of the TreeWidget (or rather, the size left for the cell after indentation, the little icon showing expandedness, etc.) in that method. cell_area is None there. I can access the width of the cell from on_render(), (it seems to be cell_area.width) but I don't see a way to change the height of the cell there. Is there a way to solve this? Thanks in advance, Abel Daniel ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] CVS branches and plans for the future.
On Wed, 2003-09-03 at 19:19, James Henstridge wrote: > On 3/09/2003 9:50 AM, Malcolm Tredinnick wrote: [...] > >What do you think about moving the gtksourceview bindings into the main > >module (I'm not sure where exactly in the directory tree)? This is all > >said without having talked to the maintainer about his plans, but I like > >the idea of having a single-source download for this kind of stuff. > >Things like vte are different, since it includes the Python bindings in > >the main module. > > > This is an interesting question. I really don't want to stick bindings > for too many libraries into the pygtk tarball. I think it is a good > thing that it is fairly low in the dependency stack, since it makes it > easier for other packages to depend on pygtk for their builds. > > Making these sort of things optional dependencies is really a copout > though. For people building packages (ie. Linux distros, etc), the > optional dependencies are essentially hard dependencies if they want all > features of the package to be built (even if they then split things up > into multiple binary packages). If pygtk has an optional dependency on > libfoo, then other packages that depend on pygtk (optional or not) will > also depend on libfoo. If these dependencies get too complex, they are > likely to either (a) not build pygtk's libfoo binding, or parts of other > packages that depend on pygtk. I agree with all of this. My original mail may not have been too clear: I was asking about including it under the gnome-python CVS module, not inside pygtk itself. It is already beneficial to only need a stack that goes up to GTK+ to build PyGTK. > Now it might make sense to distribute the GtkSourceView binding with > gnome-python. Alternatively, it might make sense to package them with > GtkSourceView itself (like with VTE). I don't know. Obviously the latter makes the most sense. Rather than us all having a hearty round or two of "it would be nice...", I will follow this up with the various maintainers and see what falls out. Cheers, Malcolm ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] CVS branches and plans for the future.
On 3/09/2003 9:50 AM, Malcolm Tredinnick wrote: Firstly, sincere congratulations on making the 2.0.0 releases. It is wonderful to see all your hard work over the years pay off so far. :) Thanks! [stuff about pygtk future] Agreed. [stuff about pyorbit] Yes and yes. What do you think about moving the gtksourceview bindings into the main module (I'm not sure where exactly in the directory tree)? This is all said without having talked to the maintainer about his plans, but I like the idea of having a single-source download for this kind of stuff. Things like vte are different, since it includes the Python bindings in the main module. This is an interesting question. I really don't want to stick bindings for too many libraries into the pygtk tarball. I think it is a good thing that it is fairly low in the dependency stack, since it makes it easier for other packages to depend on pygtk for their builds. Making these sort of things optional dependencies is really a copout though. For people building packages (ie. Linux distros, etc), the optional dependencies are essentially hard dependencies if they want all features of the package to be built (even if they then split things up into multiple binary packages). If pygtk has an optional dependency on libfoo, then other packages that depend on pygtk (optional or not) will also depend on libfoo. If these dependencies get too complex, they are likely to either (a) not build pygtk's libfoo binding, or parts of other packages that depend on pygtk. Now it might make sense to distribute the GtkSourceView binding with gnome-python. Alternatively, it might make sense to package them with GtkSourceView itself (like with VTE). I don't know. Any comments? My only real request is to continue supporting Python 2.2. I was one of the people in favour of requiring 2.2 early on, so this risks sounding hypocritical, but the changes between 2.2 and 2.3 are not as large as from 2.1 to 2.2 and there will be a lot of installations with no plans to upgrade for some time. (OK, this is partly selfish: I've just got people at work beginning to use some apps in PyGTK and we have no upgrade plans in the near future for a large number of pragmatic reasons.) (In case that sounds wrong in email, I am not sure what your plans are -- this is just a pre-emptive $0.02 strike. :-) ) There is one big improvement in Python 2.3 that would be worth making use of: the new PyGILState APIs, which could significantly reduce the complexity of PyGTK's thread support (and get it to play nicer with other threading aware Python extensions): http://www.python.org/peps/pep-0311.html It is definitely worth experimenting here. Whether we go for conditional compilation, or disabling threading for Python 2.2, or not make use of it at all is not clear. For a non-threaded build, I see no reason to require 2.3 though. James. -- Email: [EMAIL PROTECTED] WWW: http://www.daa.com.au/~james/ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/