Successfully installed PyQt-builder-1.13.0 packaging-21.3 ply-3.11 pyparsing-3.0.9 setuptools-65.3.0 sip-6.6.2 toml-0.10.2
Cleaning up...
Removing source in /tmp/pip-install-2gmr_frd/sip
Removed build tracker: '/tmp/pip-req-tracker-vuj8lfsc'
Installing build dependencies ... done
Running command /usr/bin/python3 /tmp/tmppi_h1r7x get_requires_for_build_wheel /tmp/tmpx88x82dh
Getting requirements to build wheel ... done
Created temporary directory: /tmp/pip-modern-metadata-b__1na9b
Running command /usr/bin/python3 /tmp/tmpwp46ffki prepare_metadata_for_build_wheel /tmp/tmpxrg1n2t9
Querying qmake about your Qt installation...
This is the GPL version of PyQt 5.15.7 (licensed under the GNU General Public License) for Python 3.8.2 on linux.
Type 'L' to view the license.
Type …
Run Code Online (Sandbox Code Playgroud) 虽然 Qt 提供了 QGraphicsDropShadowEffect,但没有可用的“ Neumorphism ”效果:
在 css 中有一个box-shadow
属性(上图中就是这样做的),它可以有多种颜色,但 Qt 缺乏对该属性的支持,并且一次应用多个图形效果是不可能的。
这能做到吗?
我正在创建名为“webengine”的简单 QT 应用程序
\npWebView = new QWebEngineView(this);\npWebView->load(QUrl("http://technoz.ru"));\npWebView->show();\n// On application close\ndelete pWebView;\n
Run Code Online (Sandbox Code Playgroud)\n该应用程序创建一个名为“webengine”的标准文件夹用于存储和cookie。域设置 24 小时的 cookie。但关闭并再次打开应用程序后,cookie 丢失了。在文件夹“webengine”中创建的 \xd0\xa1ookies 文件 - 空(我在 sqlbrowser 中检查它)。但是,如果您停留在页面 30 - 40 秒,cookie 就会被保存。
\n为什么cookie不立即保存,如何立即保存?
\n在测试过程中发现,QT(chromium)会在30秒(恒定)内通过浏览器自动存储cookie,如果经过的时间较短,则不会保存cookie。这次可以改吗?我尝试使用标志 - --profiling-flush=5,但它没有帮助。
\n假设关闭浏览器时浏览器必须保留存储(cookies),但它没有,这是否是QT的一个bug?
\n我可以从源代码构建 QT,\xd0\xb0nd 在源代码中找到并更改此设置,我想,但是,也许这个问题有其他解决方案......
\n感谢大家,发现了错误:\n https://bugreports.qt.io/browse/QTBUG-52121
\n我创建了一个自定义QPushButton
,允许从菜单或a中选择颜色QColorDialog
.由于它是"主题"编辑器的一部分,我还添加了对QUndoStack的支持:每次更改自定义按钮的颜色时,它都会创建一个QUndoCommand的子类,并将其推送到QUndoStack.
然后我意识到(根据这个)每次执行a时QUndoStack.push(cmd)
,该命令都会执行(显然会创建一个递归,由PyQt自动"忽略",但仍然在stdout中报告).
我通过在redo()
调用时阻止目标小部件上的信号来解决问题,但问题仍然存在:为什么首先执行推送命令?
从我的角度来看,如果我将命令推送到撤消堆栈,它已经被执行了.
什么情况下(理论上已经)执行[子类] QUndoCommand
必须"再次"执行?
这种情况是否常见,需要将此类实现作为默认行为?
接下来,一个最小的和不完整的(但足以显示问题)的例子; 它不支持撤消/重做动作的信号处理,但这不是重点(我认为?).据我所知,问题出现在调用QUndoCommand创建的信号与创建信号本身的插槽重合时:
#!/usr/bin/env python2
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
class UndoCmd(QtWidgets.QUndoCommand):
def __init__(self, widget, newColor, oldColor):
QtWidgets.QUndoCommand.__init__(self)
self.widget = widget
self.newColor = newColor
self.oldColor = oldColor
def redo(self):
self.widget.color = self.newColor
class ColorButton(QtWidgets.QPushButton):
colorChanged = QtCore.pyqtSignal(QtGui.QColor)
def __init__(self, parent=None):
QtWidgets.QPushButton.__init__(self, 'colorButton', parent)
self.oldColor = self._color = self.palette().color(self.palette().Button)
self.clicked.connect(self.changeColor)
@QtCore.pyqtProperty(QtGui.QColor)
def color(self):
return self._color
@color.setter
def …
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建自定义动画按钮我找到了此页面:按钮示例
我喜欢这个网站上的 3 和 19。我试过做3个,但不一样。有人能帮我吗?
我的网站上第三个按钮的代码:
# -*- coding: utf-8 -*-
import sys, os, time, math
from PySide6 import QtCore, QtWidgets, QtGui
from PySide6.QtWidgets import *
from PySide6.QtCore import *
from PySide6.QtGui import *
class EButton3(QPushButton):
AnimateEnabled = True
Radius = 10
_m_Text = ""
def __init__(self, parent=None):
super(EButton3, self).__init__(None)
self.enterEvent = self.Custom_enterEvent
self.leaveEvent = self.Custom_leaveEvent
self.setText("Button")
def getText(self):
return self._m_Text
def setText(self, Text):
self._m_Text = Text
self.update()
_m_hover=False
def isHover(self):
return self._m_hover
def paintEvent(self, event: QPaintEvent):
ret = …
Run Code Online (Sandbox Code Playgroud) 我在kivy上做了一个简单的OSC测试,看起来我在Android手机上运行它们时遇到了问题.为了更好地理解Kivy和OSC是如何工作的,我做了一个小测试,它应该显示应用程序和另一台计算机之间的通信.一个服务器
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.gridlayout import *
from kivy.uix.button import Button
from kivy.clock import Clock
from kivy.lib.osc import oscAPI
class CButton(Button):
def __init__(self, **kwargs):
kwargs['text'] = kwargs.get('text', 'empty')
super(CButton, self).__init__(**kwargs)
class OscWidget(GridLayout):
def __init__(self, **kwargs):
super(OscWidget, self).__init__(**kwargs)
def callback(self, instance, *args):
self.oscbutton.text = instance[2]
oscAPI.sendMsg('/current/reply', dataArray=['answer'], ipAddr='192.168.1.101', port=8889)
class OscButtonApp(App):
def buttpress(self, *args):
oscAPI.sendMsg('/current/reply', dataArray=['call'], ipAddr='192.168.1.101', port=8889)
def build(self):
btnapp = OscWidget()
oscAPI.init()
oscid = oscAPI.listen(port=8889)
osc.bind(oscid, btnapp.callback, '/test/reply')
Clock.schedule_interval(lambda *x: osc.readQueue(oscid), 0)
return …
Run Code Online (Sandbox Code Playgroud) 我想制作一个美丽而多汁的霓虹灯效果,并且能够控制光的力量。为此,我构建了这样的代码
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class Window(QWidget):
def __init__(self):
super().__init__()
self.resize(800, 800)
self.setStyleSheet('background:black;')
mainLayout = QVBoxLayout(self)
mainLayout.setContentsMargins(0, 0, 0, 0)
color_1 = '162, 162, 162,'
color_2 = '255, 255, 255,'
color_3 = '0, 255, 255,'
d_ = 1
power = int(255/100*d_)
for x in range(6):
label = QLabel(self)
color_L = color_1
glass_L = 255
size_L = 60
blut_L = 0
label.raise_()
if x < 1 :
color_L = color_1
elif …
Run Code Online (Sandbox Code Playgroud)