[Scribus] Scripter gtk-gui problem

Craig Ringer craig
Thu Dec 16 06:00:46 CET 2004


On Thu, 2004-12-16 at 18:55, Kobus Wolvaardt wrote:

> Where do I look? And what am I looking for? I am running Mepis Pro and  
> there are some strange apt-get problem. I cant install python2.3-dev (it  
> wants to uninstall my whole pc). So I added python2.4 and 2.4-dev. The  
> strange part is, it didnt remove 2.3

That's not unusual - multiple Python versions can happily co-exist.

> and there are no python2.4-gtk  
> packages only python2.3-gtk. Mmmmm I'll have to fix that...

Given that you have two versions of Python installed, it sounds to me
like you're probably getting one from the command line and the other
from Scribus.

To confirm this, run this both in the command line interpreter and the
Scribus script console:

import sys
print sys.version

and compare the version numbers. At a guess, you're getting 2.4 in
Scribus and 2.3 on the command line.

If this is the case, you can just download and install PyGtk yourself. 
http://www.pygtk.org/

just:

tar xvzf
cd into the new directory
/path/to/Python/2.4/python setup.py build
sudo /path/to/Python/2.4/python setup.py install

and you should be set.

> In the mean time I'm taking a long weekend with my notebook, scribus,  
> python and a few tkinter manuals. Hopefully I'll get it working. I also  
> have to rewrite most of the code and make a formal article structure. I  
> think I'll just develop it so that any gui can be dropped in at a later  
> stage.

That sounds like a very good plan to me. I favour putting core code in a
gui-independent module (a separate file that's imported by the main
program), putting GUI code in another module, and gluing it all together
with a small and simple main program that works with the two.

> > Be aware that if you use PyGtk then users must install PyGtk in order to
> > run your scripts.
> 
> Thats ok for me since I'll be configuring all the layout pc's at our  
> newspaper. But hopefully a gtk an tkinter gui will be available.

Tkinter support is built in to Python, though some distros separate it
out into a separate package. It should be available everywhere - that's
its advantage.

> P.S. I pulled my code into the template you pointed me to but the  
> rendering isn't disabled. Am I doing something wrong? How do I enable the  
> render=disabled part?

Redraws are disabled by the wrapper only if there's a document already
open. Because setRedraw() operates on a document, the wrapper code can't
disable redraws in new documents you create after that - you must do
that yourself by calling scribus.setRedraw(False) .

The wrapper code _will_ make sure everything gets tidied up properly
even if your script has an error.

--
Craig Ringer





More information about the scribus mailing list