代码拉取完成,页面将自动刷新
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import *
from canvas import Canvas
from ShowCanvas import ShowCanvas
from PyQt5.QtCore import Qt
# import math
# import numpy as np
# import matplotlib.pyplot as plt
# from mpl_toolkits.mplot3d import Axes3D
class SubWnd(QtWidgets.QMdiSubWindow):
def __init__(self, parent=None):
super(SubWnd, self).__init__(parent)
self.sub = QtWidgets.QMdiSubWindow(self)
# self.style = """
# QPushButton{background-color:grey;color:white;}
# #window{ background:pink; }
# #test{ background-color:black;color:white; }
# """
# self.setStyleSheet(self.style)
# self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.setWindowFlags(QtCore.Qt.windowFlags() & ~QtCore.Qt.WindowMaximizeButtonHint & ~QtCore.Qt.WindowMinMaxButtonsHint )
self.sub.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Dialog) # | QtCore.Qt.SubWindow
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.setAttribute(QtCore.Qt.WA_TranslucentBackground, False)
# self.setMouseTracking(True)
# self.shadow_effect = QtWidgets.QGraphicsDropShadowEffect(self)
# self.shadow_effect.setOffset(-2, 2)
# self.shadow_effect.setColor(QtCore.Qt.gray)
# self.shadow_effect.setBlurRadius(2)
# self.setGraphicsEffect(self.shadow_effect)
# self.setAutoFillBackground(True)
# self.palette = QtGui.QPalette()
# self.palette.setColor(self.backgroundRole(), QtGui.QColor(255, 255, 255))
# self.palette.setColor(self.backgroundRole(), QtGui.QColor(192, 253, 123))
# self.setPalette(self.palette)
# def mousePressEvent(self, event):
# if event.button() == QtCore.Qt.LeftButton:
# self.dragPosition = event.globalPos() - self.frameGeometry().topLeft()
# event.accept()
# def mouseMoveEvent(self, event):
# if event.buttons() == QtCore.Qt.LeftButton:
# self.move(event.globalPos() - self.dragPosition)
# event.accept()
# def paintEvent(self, event):
# path = QtGui.QPainterPath()
# path.setFillRule(QtCore.Qt.OddEvenFill)
# path.addRect(0, 0, self.width(), self.height())
# painter = QtGui.QPainter()
# painter.setRenderHint(QtGui.QPainter.Antialiasing, True)
# painter.fillPath(path, QtGui.QBrush(QtCore.Qt.white))
#
# color = QtGui.QColor(50, 180, 190, 50)
#
# for i in range(0, 3):
# path = QtGui.QPainterPath()
# path.setFillRule(QtCore.Qt.WindingFill)
# # path.addRect(3 - i, 3 - i, self.width() - (3 - i) * 2, self.height() - (3 - i) * 2)
# path.addRect(0, 0, self.width(), self.height())
# color.setAlpha(150 - math.sqrt(i) * 50)
# painter.setPen(color)
# painter.drawPath(path)
class ChartSubWnd(SubWnd):
def __init__(self, parent=None):
super(SubWnd, self).__init__(parent)
self.chart_canvas = Canvas()
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowSystemMenuHint)
self.setWidget(self.chart_canvas)
def update_data(self, x):
self.chart_canvas.update_figure(x)
# pass
# '''
# class HeatSubWnd(SubWnd):
# def __init__(self, parent=None):
# super(SubWnd, self).__init__(parent)
# self.heat_canvas = Canvas()
# self.setWidget(self.heat_canvas)
#
# def update_data(self, x):
# self.heat_canvas.update_figure(x)
# # pass
# '''
class D3SubWnd(SubWnd):
def __init__(self, parent=None):
super(SubWnd, self).__init__(parent)
self.setWindowTitle("3D")
self.d3_canvas = ShowCanvas()
# self.fig = plt.figure()
# ax = Axes3D(self.fig)
# X = np.arange(-4, 4, 0.25)
# Y = np.arange(-4, 4, 0.25)
# X, Y = np.meshgrid(X, Y)
# R = np.sqrt(X ** 2 + Y ** 2)
# Z = np.sin(R)
# ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=plt.get_cmap('rainbow'))
#
# # plt.show()
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowSystemMenuHint)
self.setWidget(self.d3_canvas)
def update_data(self, x):
self.d3_canvas.update_figure(x)
# pass
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。