sczesla / PyAstronomy

A collection of astronomy-related routines in Python
156 stars 35 forks source link

TclError when using pyaGui #1

Closed DanielAndreasen closed 10 years ago

DanielAndreasen commented 10 years ago

Hi,

When I try to use the pyaGui (which I succesfully used with pleasure before) I now get the following error:

In [1]: from PyAstronomy import pyaGui

In [2]: pyaGui.Picker()
---------------------------------------------------------------------------
TclError                                  Traceback (most recent call last)
<ipython-input-2-758404c11150> in <module>()
----> 1 pyaGui.Picker()

/usr/local/lib/python2.7/dist-packages/PyAstronomy/pyaGui/pyaPicker.pyc in __init__(self)
     88     self.cid = self.f.canvas.mpl_connect('button_press_event', self._mouseButtonClicked)
     89 
---> 90     self.toolbar = NavigationToolbar2TkAgg(self.canvas, self.plotFrame)
     91     self.toolbar.update()
     92     self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)

/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.pyc in __init__(self, canvas, window)
    799         self._idle = True
    800         #Tk.Frame.__init__(self, master=self.canvas._tkcanvas)
--> 801         NavigationToolbar2.__init__(self, canvas)
    802 
    803     def destroy(self, *args):

/usr/lib/pymodules/python2.7/matplotlib/backend_bases.pyc in __init__(self, canvas)
   2700         self._active = None
   2701         self._lastCursor = None
-> 2702         self._init_toolbar()
   2703         self._idDrag = self.canvas.mpl_connect(
   2704             'motion_notify_event', self.mouse_move)

/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.pyc in _init_toolbar(self)
    860         self._message_label = Tk.Label(master=self, textvariable=self.message)
    861         self._message_label.pack(side=Tk.RIGHT)
--> 862         self.pack(side=Tk.BOTTOM, fill=Tk.X)
    863 
    864 

/usr/lib/python2.7/lib-tk/Tkinter.pyc in pack_configure(self, cnf, **kw)
   1888         self.tk.call(
   1889               ('pack', 'configure', self._w)
-> 1890               + self._options(cnf, kw))
   1891     pack = configure = config = pack_configure
   1892     def pack_forget(self):

TclError: cannot use geometry manager pack inside .139918394899704 which already has slaves managed by grid

I tried uninstall and install PyAstronomy a couple of time, the same with matplotlib, but nothing seems really to work. The closest thing I got to something looks like a solution is here: http://stackoverflow.com/questions/23584325/cannot-use-geometry-manager-pack-inside

You have any suggestions what might be wrong?

Cheers, Daniel

sczesla commented 10 years ago

Hi Daniel, wow this is a tough one! on first sight i have no clue what is going wrong. Will be traveling this week so i am a little limited in my ability to look into this. Sorry for that. I will have a look at this next week and come back to you. Cheers, stefan

On 22. Juni 2014 16:39:37 MESZ, Daniel Thaagaard Andreasen notifications@github.com wrote:

Hi,

When I try to use the pyaGui (which I succesfully used with pleasure before) I now get the following error:

In [1]: from PyAstronomy import pyaGui

In [2]: pyaGui.Picker()

TclError Traceback (most recent call last)

in () ----> 1 pyaGui.Picker() /usr/local/lib/python2.7/dist-packages/PyAstronomy/pyaGui/pyaPicker.pyc in **init**(self) 88 self.cid = self.f.canvas.mpl_connect('button_press_event', self._mouseButtonClicked) 89 ---> 90 self.toolbar = NavigationToolbar2TkAgg(self.canvas, self.plotFrame) 91 self.toolbar.update() 92 self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True) /usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.pyc in **init**(self, canvas, window) 799 self._idle = True 800 #Tk.Frame.__init__(self, master=self.canvas._tkcanvas) --> 801 NavigationToolbar2.__init__(self, canvas) 802 803 def destroy(self, *args): /usr/lib/pymodules/python2.7/matplotlib/backend_bases.pyc in **init**(self, canvas) 2700 self._active = None 2701 self._lastCursor = None -> 2702 self._init_toolbar() 2703 self._idDrag = self.canvas.mpl_connect( 2704 'motion_notify_event', self.mouse_move) /usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.pyc in _init_toolbar(self) 860 self._message_label = Tk.Label(master=self, textvariable=self.message) 861 self._message_label.pack(side=Tk.RIGHT) --> 862 self.pack(side=Tk.BOTTOM, fill=Tk.X) 863 864 /usr/lib/python2.7/lib-tk/Tkinter.pyc in pack_configure(self, cnf, **kw) 1888 self.tk.call( 1889 ('pack', 'configure', self._w) -> 1890 + self._options(cnf, kw)) 1891 pack = configure = config = pack_configure 1892 def pack_forget(self): TclError: cannot use geometry manager pack inside .139918394899704 which already has slaves managed by grid I tried uninstall and install PyAstronomy a couple of time, the same with matplotlib, but nothing seems really to work. The closest thing I got to something looks like a solution is here: http://stackoverflow.com/questions/23584325/cannot-use-geometry-manager-pack-inside You have any suggestions what might be wrong? Cheers, Daniel --- Reply to this email directly or view it on GitHub: https://github.com/sczesla/PyAstronomy/issues/1

Dr. Stefan Czesla Hamburger Sternwarte

DanielAndreasen commented 10 years ago

Hi Stefan,

That is okay. Right now I only need it for some plots, but that can wait a little. Looking forward to some help on this one. I'll keep you updated if I find a solution.

Cheers, Daniel

sczesla commented 10 years ago

Hi Daniel, I suspect it might have something to do with the tk version. Could you please check the version: import Tkinter print Tkinter.TclVersion Just to check whether it is worth to dig further. Cheers, Stefan

DanielAndreasen commented 10 years ago

It is a place to start. I have version 8.6. Do you want me to try downgrade or upgrade?

Cheers, Daniel

sczesla commented 10 years ago

Thanks for checking. Well, let me put it like that: If you would downgrade to version 8.5, I think it would work. However, this seems more like a work around than a solution. The actual problem appears to be a run-in of pack and grid (the error message says that already, of course), which turned into an error in the latest version of tcl/tk. I will try to sort this out. Cheers, Stefan

DanielAndreasen commented 10 years ago

I will try this during the weekend or in the beginning of the next week. Hopefully this will be a good work around. Cheers, Daniel

DanielAndreasen commented 10 years ago

I took a look at it today. As far as I understand, the module comes with python-tk. However, on my system there are only one version available. I'm running Linux Mint 17 Cinnamon 64-bit.

sczesla commented 10 years ago

Hi Daniel, no problem. Changing the Tcl version can be tricky. I have reproduced the behavior and basically solved the problem. I need a little more time to produce a version, which I can push to the repo. I will keep you informed. Stefan

DanielAndreasen commented 10 years ago

Hi Stefan,

That sounds very good. I look foreward to test it on my computer. /Daniel

sczesla commented 10 years ago

OK. Pushed to repo. Hope that will work for you. Stefan

DanielAndreasen commented 10 years ago

I works without any problems! Thank you very much for your help.