This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Adafruit_DHT | |
import time | |
isRunning = True | |
while isRunning: | |
try: | |
humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.DHT11, 4) | |
if humidity is not None and temperature is not None: | |
print('Temp={0:0.1f}* Humidity={1:0.1f}%'.format(temperature, humidity)) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtCore import QFileInfo, QSettings | |
from PyQt5.QtGui import QIcon | |
from PyQt5.QtWidgets import qApp, QApplication, QMainWindow, QFormLayout, QLineEdit, QTabWidget, QWidget, QAction | |
def restore(settings): | |
finfo = QFileInfo(settings.fileName()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QCheckBox, QLineEdit | |
from functools import partial | |
class Widget(QWidget): | |
def __init__(self, parent=None): | |
QWidget.__init__(self, parent) | |
self.setLayout(QVBoxLayout()) | |
self.le = QLineEdit(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, time | |
from PyQt4 import QtGui, QtCore | |
class Window(QtGui.QMainWindow): | |
def __init__(self): | |
super(Window, self).__init__() | |
self.setGeometry(50, 50, 500, 200) | |
self.setWindowTitle("TEST APP!") | |
self.field_dict = {} | |
self.home() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Stadium(QWidget): | |
def __init__(self, pixmap, parent=None): | |
QWidget.__init__(self, parent=parent) | |
self.pixmap = pixmap | |
self.pos = None | |
self.setMouseTracking(True) | |
def paintEvent(self, event): | |
painter = QPainter(self) | |
w = min(1.0*self.width()/self.pixmap.width(), 1.0*self.height()/self.pixmap.height()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
#Importing PyQt5 library to construct widgets for Graphic User Interface (GUI) application | |
from PyQt5 import QtCore, QtGui, QtWidgets | |
from PyQt5.QtWidgets import (QLineEdit, QPushButton, QSlider, QApplication, QVBoxLayout, QHBoxLayout, | |
QApplication, QWidget, QLabel, QCheckBox, QRadioButton, QPlainTextEdit, QSizePolicy, | |
QMainWindow,QFrame, QFileDialog, QTableWidgetItem, QTableWidget, QMenu, QMessageBox, | |
QAction, QToolBar) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas | |
import matplotlib.pyplot as plt | |
class Canvas(FigureCanvas): | |
def __init__(self, parent=None): | |
self.figure = plt.figure() | |
FigureCanvas.__init__(self, self.figure) | |
self.setParent(parent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt5.QtGui import QGuiApplication, QColor | |
from PyQt5.QtQml import QQmlApplicationEngine, QQmlComponent | |
from PyQt5.QtCore import QUrl, Qt, QCoreApplication, QAbstractListModel, QModelIndex, QTimer, qsrand, qrand, QTime | |
from PyQt5.QtQuick import QQuickItem | |
class Data(object): | |
def __init__(self, width=35, height=35, color=QColor("red")): | |
self._width = width | |
self._height = height | |
self._color = color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt5.QtGui import * | |
from PyQt5.QtCore import * | |
from PyQt5.QtWidgets import * | |
import sys | |
class Widget(QWidget): | |
def __init__(self, parent=None): | |
QWidget.__init__(self, parent) | |
self.setLayout(QVBoxLayout()) | |
self.le = QLineEdit(":P", self) |
OlderNewer