[scribus] [scripter] Strange behavior of tkMessageBox.showerror()

Gregory Pittman gregp_ky at yahoo.com
Wed Sep 8 14:35:51 CEST 2010


On 09/07/2010 04:02 PM, Sam Qasbah wrote:
> Hallo to all of you.
>
> I use scribus 1.3.3.13svn on ubuntu 10.04.
>
> This is a script that I wrote as an example of a procedure aimed to check
> the systems requirements, and that causes the crash of scribus.
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> import Tkinter as tk
> import tkMessageBox as tkmb
> import sys
>
> def main1():
>      errMsg = "This script requires Python v. 8.5 or later.\nYou are using
> Python v. %s" % sys.version.split()[0]
>      print errMsg
>      root = tk.Tk()    ### (1)
>      root.withdraw()    ### (2)
>      tkmb.showerror('Python error', errMsg) ### (3)
>      sys.exit(1)
>
> def main2():
>      errMsg = "This script requires Python v. 8.5 or later.\nYou are using
> Python v. %s" % sys.version.split()[0]
>      print errMsg
>      tkmb.showerror('Python error', errMsg)
>      sys.exit(1)
>
> if __name__ == '__main__':
>      # comment or uncomment to respectively test main1 OR main2
>      main1()
>      #main2()
>
> in main1 the lines (1) and (2) are a trick to center the message box and to
> not let appear the root window. main2 is the same function as main1 but
> without the lines (1) and (2)
> The problem is that, as in main1 as same in main2, when I run this script
> scribus crashes, and it doesn't work any more. The messagebox remains on the
> screen and nothing happens.
>
> I tested the same script in the linux console and it works very well.
>
> Where is the problem? Am I in fault or what else?

In the past at least there have been some issues with Tkinter in 
Scribus. It's been so long, I can't remember what they were. Craig 
Ringer helped me through them.

It's one of the reasons why I stopped using Tkinter. Why don't you just 
use the built-in message box in Scripter?

Greg



More information about the scribus mailing list