2016-05-24 22 views
1

私のアプリケーションでは、図の中でカーソルウィジェットを無効にして再度有効にしたいと考えています。残念ながら、カーソルが以前に無効にされている場合、Cursorを再表示させることはできないようです。 Cursorウィジェット(set_active、disconnect_events ...)のいくつかのメソッドを試しましたが、成功しませんでした。以下を考慮してください:Matplotlibウィジェット接続解除/再接続後にカーソルが再表示されない

from matplotlib.widgets import Cursor 
import matplotlib.pyplot as plt 

def onevent(event): 
    print "you clicked!" 

plt.ion() 
fig=plt.figure() 
ax=fig.add_subplot(111) 
c=Cursor(ax) # the cursor appears on my figure. Fine. 

c.connect_event('button_press_event',onevent) # the cursor is connected. Fine 
c.disconnect_events() # the cursor is disconnected, and has disappeared. Fine 
c.connect_event('button_press_event',onevent) # the cursor is connected again (fine), but HAS NOT REAPPEARED (not fine!) 

この現象を再現できますか? この動作は、qt、tk、またはwxバックエンドのいずれかで発生します。おかげさまで

答えて

0

私は、カーソル(c.disconnect_event())を切断し、カーソル(c = Cursor(ax))を再作成することで、必要な操作を行うことができました。... メソッドset_active )は、カーソルを消して再表示しますが、カーソルを「イベント」から切断しません。

関連する問題