tilo81

arcpy and easygui - eventloop conflict?

Discussion created by tilo81 on Apr 4, 2011
Latest reply on Apr 4, 2011 by tilo81
Dear core development team and others,

In my programm I use easygui for userinputs. When the arcpy module is imported a conflict between those two modules appears when calling easygui.choicebox(...) or easygui.multchoicebox(...) with a list longer then the guifield can show at once. Without importing arcpy, easygui works fine.

download easygui: http://easygui.sourceforge.net/download/ 

the script easygui.py has to get slightly modified: replace the two instances of "4.5i" with "10cm", then it works together with arcpy. Then copy it into the python2.6/lib/side-package folder

When you execute this script, you will see the conflict:

--------------------

import easygui
import arcpy
posNameChar = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
           'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
           'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
           'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
           '1','2','3','4','5','6','7','8','9','0']
easygui.choicebox(msg='', title='', choices=(posNameChar))

----------------------------

Traceback:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__
    return self.func(*args)
  File "C:\Python26\lib\lib-tk\Tkinter.py", line 2813, in set
    self.tk.call((self._w, 'set') + args)
TclError: expected floating-point number but got "0,129032"



The number in the Traceback seems to be the position of the scrollbar, where somehow a comma has replaced the point. ???

Scrolling is still possible by mousewheel or keyboard. The scrollbar doesn't work which isn't a big Problem, but Its not nice to have Errormessages shown in the console all the time ;)

The developer of easygui assumes a Tkinter event-loop conflict as the root of this problem which supposedly goes deeper than the "4.5i" problem. But he doesn't have arcpy to check, if he is right and to develope a fix for easygui.

Does someone have any ideas how to fix this or where the problem might be located and does someone know if just importing arcpy opens an tkinter event-loop?



thanks,

Tilo

Outcomes