Issue
I have here this situation:
btn_1 = QtGui.QPushButton("1", self)
btn_1.move(0, 20)
btn_2 = QtGui.QPushButton("3", self)
btn_2.move(100, 20)
btn_3 = QtGui.QPushButton("3", self)
btn_3.move(200, 20)
fig = pyplot.figure()
#---plot things---#
canvas = FigureCanvas(fig)
self.setCentralWidget(canvas) #here is the problem
I get a canvas from matplotlib and set it in my PySide window, but when I do it, the widget canvas is generated above the buttons. I'd like to set the position of the canvas.
self is a object of this class:
class myForm(QtGui.QMainWindow)
Solution
You should use layout classes like QHBoxLayout()
and QVBoxLayout
but I think your class must inherit QWidget
(look here for examples of how to use layout classes). If you want to use QMainWindow
(which has its own layout) you have to put your buttons/actions in a QToolBar
, QDockBar
or QMenuBar
. See in the
docs the layout of QMainWindow
.
Answered By - doru
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.