1 Star 0 Fork 0

Michael Ji/Temperature Monitor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
subwindow.py 4.28 KB
一键复制 编辑 原始数据 按行查看 历史
Tommy.Hui 提交于 2018-09-20 22:09 . 1, 去掉“heat”chart
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/jibintao/Temperature-Monitor.git
git@gitee.com:jibintao/Temperature-Monitor.git
jibintao
Temperature-Monitor
Temperature Monitor
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385