本文整理汇总了Python中matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg.setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasQTAgg.setStyleSheet方法的具体用法?Python FigureCanvasQTAgg.setStyleSheet怎么用?Python FigureCanvasQTAgg.setStyleSheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg
的用法示例。
在下文中一共展示了FigureCanvasQTAgg.setStyleSheet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_plot
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setStyleSheet [as 别名]
def _create_plot(self):
dpi = plt.rcParams['figure.dpi']
figsize = (self._plot_width / dpi, self._plot_height / dpi)
figure = plt.figure(frameon=False, figsize=figsize)
axes = figure.add_subplot(111)
canvas = FigureCanvas(figure)
canvas.setFocusPolicy(QtCore.Qt.ClickFocus)
canvas.setFixedSize(self._plot_width, self._plot_height)
canvas.setStyleSheet("background: transparent")
return axes, canvas
示例2: MainWindow
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setStyleSheet [as 别名]
class MainWindow(QtGui.QMainWindow):
"""Balloon tracker main window"""
updatetrigger = QtCore.pyqtSignal()
def __init__(self):
"""Initialise main window"""
super(MainWindow, self).__init__()
# Create data handler (creates also data collector)
self.datahandler = aprs_daemon.DataHandlerThread(self)
self.setWindowTitle("Balloon Tracker")
self.setObjectName("mainwindow")
self.resize(800, 600)
centralwidget = QtGui.QWidget(self)
self.updatetrigger.connect(self._update_all)
sizepol = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
sizepol.setHorizontalStretch(0)
sizepol.setVerticalStretch(0)
sizepol.setHeightForWidth(centralwidget.sizePolicy().hasHeightForWidth())
centralwidget.setSizePolicy(sizepol)
centralwidget.setObjectName("centralwidget")
mainlayout = QtGui.QHBoxLayout(centralwidget)
mainlayout.setMargin(0)
mainlayout.setObjectName("mainlayout")
gridlayout = QtGui.QGridLayout()
gridlayout.setSizeConstraint(QtGui.QLayout.SetNoConstraint)
gridlayout.setSpacing(0)
gridlayout.setObjectName("gridlayout")
# compass area
self.compass = None
self.distancelabel = None
gridlayout.addWidget(self.create_compass(centralwidget), 1, 1, 1, 1)
# data area
self.items = []
gridlayout.addWidget(self.create_dataframe(centralwidget), 0, 1, 1, 1)
# plot area
self.canvas = None
self.plots = []
self.axes = []
gridlayout.addWidget(self.create_plot(centralwidget), 1, 0, 1, 1)
#map area
self.webview = None
self.create_map(centralwidget)
gridlayout.addWidget(self.webview, 0, 0, 1, 1)
mainlayout.addLayout(gridlayout)
self.setCentralWidget(centralwidget)
#menubar
self.startstop = None
self.followtoggle = None
self.followtarget = 0
self.setMenuBar(self.create_menubar())
#statusbar
self.statusbar = QtGui.QStatusBar(self)
self.statusbar.setObjectName("statusbar")
self.setStatusBar(self.statusbar)
self.runstatus = QtGui.QLabel("Ready")
self.statusbar.addPermanentWidget(self.runstatus)
self.followstatus = QtGui.QLabel("Balloon")
self.statusbar.addPermanentWidget(self.followstatus)
self.gpsstatus = QtGui.QLabel("GPS")
self.gpsstatus.setStyleSheet('color: gray')
self.statusbar.addPermanentWidget(self.gpsstatus)
self.statusmessage = QtGui.QLabel("")
self.statusbar.addPermanentWidget(self.statusmessage, 1)
#toolbar
#self.toolBar = QtGui.QToolBar(self)
#self.toolBar.setObjectName("toolBar")
#self.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
def create_compass(self, parent):
"""Create compass area"""
compassframe = QtGui.QFrame(parent)
compassframe.setAutoFillBackground(False)
#compassframe.setStyleSheet("background-color: rgb(255, 255, 255);")
# compassframe.setFrameShape(QtGui.QFrame.StyledPanel)
# compassframe.setFrameShadow(QtGui.QFrame.Raised)
compassframe.setObjectName("compassframe")
compasslayout = QtGui.QVBoxLayout(compassframe)
compasslayout.setMargin(0)
compasslayout.setObjectName("compasslayout")
palette = QtGui.QPalette()
palette.setColor(QtGui.QPalette.Base, QtCore.Qt.darkBlue)
palette.setColor(QtGui.QPalette.Foreground,
QtGui.QColor(QtCore.Qt.darkBlue).dark(120))
palette.setColor(QtGui.QPalette.Text, QtCore.Qt.white)
self.compass = Qwt.QwtCompass()
self.compass.setLineWidth(4)
self.compass.setScaleTicks(1, 1, 3)
self.compass.setScale(36, 5, 0)
self.compass.setReadOnly(True)
self.compass.setNeedle(Qwt.QwtCompassMagnetNeedle(
Qwt.QwtCompassMagnetNeedle.ThinStyle))
self.compass.setValue(0.0)
compasslayout.addWidget(self.compass)
self.distancelabel = QtGui.QLabel("NA")
self.distancelabel.setAlignment(QtCore.Qt.AlignCenter)
compasslayout.addWidget(self.distancelabel)
return compassframe
#.........这里部分代码省略.........