小编Dio*_*rra的帖子

PyQt5现在显示图标?

我刚刚安装了python3(3.5.2)和Pyqt5(5.8.2),我按照本教程学习并制作了一个GUI:

http://zetcode.com/gui/pyqt5/firstprograms/

我正在尝试运行第二个例子但程序被给出一个错误(这也发生在第一个,但因为它没有图像我没有注意到)这是以下内容:

QApplication: invalid style override passed, ignoring it.
No XVisualInfo for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SwapBehavior(SingleBuffer), swapInterval 1, profile  QSurfaceFormat::OpenGLContextProfile(NoProfile))
Falling back to using screens root_visual.
Run Code Online (Sandbox Code Playgroud)

这是什么意思?我错过了一些包吗?

我先用命令安装了pyqt,

sudo -H pip3安装PyQt5但是python3并没有解释它的存在所以我搜索了apt ubuntu repos并安装了sudo apt install python3-PyQt5

我还尝试通过完整路径/foo/bar/image.png引用图像,什么都没有

问题是什么?

编辑 - 1

我使用的代码来自示例2:

#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
ZetCode PyQt5 tutorial

This example shows an icon
in the titlebar of the …
Run Code Online (Sandbox Code Playgroud)

python pyqt qicon pyqt5

4
推荐指数
1
解决办法
8309
查看次数

使用 Influx 和 python 将数据写入数据库

我正在使用 influxdb 尝试'measurements'使用 influxdb v4.0.0 在本地 influxdb 上编写一些内容...

我有点困惑,因为有些地方说你使用 dict 或者你可以使用 json 和/或线路协议......

从这里http://influxdb-python.readthedocs.io/en/latest/examples.html#tutorials-pandas从这里和这里https://github.com/influxdata/influxdb-python/blob/master/influxdb/客户端.py

1st -使用以下命令创建数据库对象:

InfluxDBClient('localhost', database='DBNAME')
Run Code Online (Sandbox Code Playgroud)

第二 -使用数据创建字典:

measurement = {}
measurement['measurement'] = 'energy'
measurement['tags'] = {}
measurement['fields'] = {}
measurement['tags']['MeterID'] = str(meterId)
measurement['fields']['Energy_Wh'] = str(eFrame.getReading())
Run Code Online (Sandbox Code Playgroud)

第三步 -将数据推送到 BD:

try:
    self.db.write(measurement)
except Exception as e:
    print e
Run Code Online (Sandbox Code Playgroud)

该程序可以运行,但没有数据存储在数据库中,而是我的控制台输出如下:

2017-01-11 12:41:09,741 - INFO - Saving Meter: MeterId = 09060178
u'points'
Meter-ID: 09060178 Energy Value (Wh): 10380300
{'fields': {'Energy_Wh': '10380300'}, 'tags': {'MeterID': …
Run Code Online (Sandbox Code Playgroud)

python post json influxdb influxdb-python

1
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×2

influxdb ×1

influxdb-python ×1

json ×1

post ×1

pyqt ×1

pyqt5 ×1

qicon ×1