资源简介
基于Python的跨平台GUI开发框架kivy搭建了燃料电池远程监控系统。可运行于Windows, Linux, Android, IOS等平台。
代码片段和文件信息
# -*- coding: utf-8 -*-
#qpy:kivy
from kivy import require
require(‘1.9.0‘) # replace with your current kivy version !
from kivy.properties import StringProperty objectProperty ListProperty NumericProperty
from kivy.uix.screenmanager import ScreenManager Screen FadeTransition
from kivy.clock import Clock
from kivy.app import App
from kivy.lang import Builder
from kivy.garden.graph import Graph MeshLinePlot
from kivy.uix.boxlayout import BoxLayout
import mysql.connector
import threading
import datetime
import time
# GLOBAL VARIABLES HERE:
localhost = ‘fuelcelldb.mysqldb.chinacloudapi.cn‘ # Server eg: localhost
dbname = ‘fuelcelldb‘ # SQL Database Name.
dbuser = ‘fuelcelldb%junge8830‘ # SQL Database Username.
dbpw = ‘junGE8830‘ # SQL Database Password.
tablename = ‘parameters‘ # SQL Table name here.
ConnFlag = 0
descripID = {‘ID‘:0 ‘voltage‘:1 ‘current‘:2 ‘temperature‘:3 ‘timestamp‘:4}
RASPBERRYPI_NAME = ‘raspberrypi‘
global realtimegraph rtgraphupdate MeasureRTPlot Outdata
realtimegraph = None
rtgraphupdate = None
global MeasureRTPlotValue # for realtimegraph measurement line value
MeasureRTPlotValue = None
Outdata = []
# for offline graph measurement line value
global offlinegraph MeasurePlotValue
offlinegraph = None
MeasurePlotValue = None
class ConnThreading(threading.Thread):
“““
Thread to connection to database in the background without
disturbing user interface.
“““
def __init__(self threadID name):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
def run(self):
print (“Starting “ + self.name)
global conn cursor ConnFlag
try:
conn = mysql.connector.connect(host=localhost
database=dbname
user=dbuser
password=dbpw)
cursor = conn.cursor()
ConnFlag = 1 # Set Connection Flag to 1 succeed so other function can be alerted.
print (“DB connected successfully! Exiting “ + self.name)
except mysql.connector.Error as e:
print(“Connection fail Error Code: \n“e)
# quit()
# Codes to save to log file here
class PromptSuccess(threading.Thread):
“““
Thread to check the ConnThreading for connection completeness
and to give return message to the displaytext input argument.
“““
def __init__(self threadID name threadtojoin displaytext):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
self.displaytext = displaytext
self.threadtojoin = threadtojoin
def run(self):
print (“Starting “ + self.name)
self.threadtojoin.join()
self.displaytext.text = “If there is no dataplease contact the author‘s mailbox zejunwen@qq.com!“
#### Individual
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-11-09 06:27 detection-and-control-system-for-fuel-cells-master\
文件 14319 2017-11-09 06:27 detection-and-control-system-for-fuel-cells-master\KivyDesignFile.kv
文件 161 2017-11-09 06:27 detection-and-control-system-for-fuel-cells-master\README.md
文件 25933 2017-11-09 06:27 detection-and-control-system-for-fuel-cells-master\main.py
- 上一篇:jsp《计算机组成原理》精品课程建设java毕业设计
- 下一篇:外文翻译-B/S结构
相关资源
- python版DES和MAC算法源码
- python实现java项目一键发布到服务器
- CTF各种加密算法解密集成java,支持
- java中jython操作把python数据类型转成
- python爬虫十万条UA User_Agent信息浏览器
- kivy-中文开发指南.
- 基于Python的TCPUDP调试助手
- python自动化打包java maven工程,并上传
- leetcode(附python、java、c)代码合集
- python写文件的小
- python 拖拽选择文件
- 用Python进行自然语言处理中文
- Python搭建的web接口聊天机器人
- Android代码-Python 3 for Android
- 基于python的opc读写和导入MSSQL/MYSQL
- lampLinux+Apache+Mysql+Perl/PHP/Python论文
- 2019最新尚硅谷1024专用全套视频打包地
- python汉化补丁pycharm2019.2版本
- C/S模式的TCP聊天室程序python和java版本
- python 调用 mysql
评论
共有 条评论