Page History
...
Code Block |
---|
pos = fig.canvas.manager.window.pos()
print 'x,y=', pos.x(), pos.y()
h3. How to move the matplotlib figure window in certain |
How to move the matplotlib figure window in certain (x,y)
...
position
Code Block |
---|
fig.canvas.manager.window.move(x,y) # in pixels from top-left corner |
or
Code Block |
---|
or plt.get_current_fig_manager().window.move(90, 100) |
...
For
...
our
...
backend
...
starting
...
from
...
python
...
2.7.2:
Code Block |
---|
plt.get_current_fig_manager().window.geometry("+100+300") |
...
|
How to move the matplotlib figure window on top (of all pileup windows)
Code Block |
---|
|
Code Block |
---|
h3. How to move the matplotlib figure window on top (of all pileup windows)
|
fig.canvas.manager.window.activateWindow() # Makes window active |
...
fig.canvas.manager.window.raise_() # Moves window on top |
...
the
...
attribute
...
trick
...
is
...
that
...
the
...
fig.canvas.manager.window
...
returns
...
the
...
QtGui.QMainWindow
...
,
...
which
...
is
...
subclass
...
of
...
QtGui.QWidget
...
with
...
all
...
that
...
useful
...
methods.
...
How to add figure as a widget of the QtGui
Code Block |
---|
fig = plt.figure(num=None figsize=(5,10), dpi=100, facecolor='w',edgecolor='w',frameon=True) |
...
vbox = QtGui.QVBoxLayout() |
...
vbox.addWidget(fig.canvas) # Wraps figure canvas in widget |
...
self.setLayout(vbox) |
...
|
How to receive a signal in program when window is activated by the mouse click on frame ?
I do not know yet...
But, if you click on figure canvas (the region inside the window frame, use
Code Block |
---|
|
Code Block |
---|
h3. How to receive a signal in program when window is activated by the mouse click on frame ?
I do not know yet...
But, if you click on figure canvas (the region inside the window frame, use
|
fig.canvas.mpl_connect('button_press_event', self.onButtonPressEvent) |
...
#Should be implemented something like: |
...
def onButtonPressEvent( self, event ): |
...
"""Figure is picked""" |
...
print 'click on fig number =', event.canvas.figure.number |
...
|
How to receive a signal in program when close window by the click on "X"
Code Block |
---|
|
Code Block |
---|
h3. How to receive a signal in program when close window by the click on "X"
|
fig.canvas.mpl_connect('close_event', self.onCloseEvent) |
...
#Should be implemented something like: |
...
def onCloseEvent( self, event ): |
...
print 'close event, fig number =', event.canvas.figure.number |
...
|
How to close figure from program call
Code Block |
---|
|
Code Block |
---|
h3. How to close figure from program call
|
plt.close( num ) # close figure with known number num |
...
... |
...
plt.close('all') # close all figures |
...
|
Overview
Content Tools