pyqt

PySide2 QThread Error: QThread: Destroyed while thread is still running

旧街凉风 提交于 2021-02-07 10:07:21
问题 I am new to PySide2. I am just trying to launch a sample application and start a thread as the application starts and want to stop the thread as the application closes. When I am closing the application I am getting the following error: QThread: Destroyed while the thread is still running. The sample_ui.py is a python file that I converted from sample_ui.ui Code: import time import sys import sample_ui from PySide2 import QtWidgets from PySide2 import QtCore class MainWindow(QtWidgets

PySide2 QThread Error: QThread: Destroyed while thread is still running

浪尽此生 提交于 2021-02-07 10:04:32
问题 I am new to PySide2. I am just trying to launch a sample application and start a thread as the application starts and want to stop the thread as the application closes. When I am closing the application I am getting the following error: QThread: Destroyed while the thread is still running. The sample_ui.py is a python file that I converted from sample_ui.ui Code: import time import sys import sample_ui from PySide2 import QtWidgets from PySide2 import QtCore class MainWindow(QtWidgets

Qt add a widget inside another widget?

烈酒焚心 提交于 2021-02-07 06:47:15
问题 I'd like to make a single widget that combines the behavior of two existing widgets. For example a widget that is a button that also contains a checkbox. The user can click the larger button but also the checkbox within. E.g. gmail introduced a "select-all" button that displays a menu on click, but it also integrates a checkbox that selects all email. See this screenshot for an example: How would one go about combining behaviors of existing widgets to this effect? I'm hoping for a solution

Is it possible to drag a QTabWidget and open a new window containing what's in this Tab in pyqt5?

我怕爱的太早我们不能终老 提交于 2021-02-07 04:38:12
问题 I'm wondering if it is possible by clicking and dragging a Tab to open a new window with what was in that Tab. If it's possible, I would like to also do the reverse: dragging the new window inside the Tabs (where it was in the first place). I don't know how should I start. I read in some forums that all must be coded but I don't know if Qt allows some facilities to do that? Here a code as a starting point: from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import *

用 Python 打造无人机战争仿真平台

陌路散爱 提交于 2021-02-06 00:39:31
智能无人机路径规划仿真系统是一个具有操作控制精细、平台整合性强、全方向模型建立与应用自动化特点的软件。 它以A、B两国在C区开展无人机战争为背景,该系统的核心功能是通过仿真平台规划无人机航线,并进行验证输出,数据可导入真实无人机,使其按照规定路线精准抵达战场任一位置,支持多人多设备编队联合行动。 视频简介 一、主要特点 系统以开源无人机仿真平台SITL为支撑,通过FlightGear渲染真实战场环境,集成了动力学模型建模、二维俯视、三维模拟、脚本控制、地面站监控、数据处理等功能,此外,仿真系统支持加载多种全球地图,模拟各大重点地域的三维环境,可应用于全球各处遥感监测的场景中。 1. 软件界面 软件界面 2. 软件架构(部分扩展功能的插件待实现) 软件架构 3. 代码编写 代码编写 4. 多维视图 二维视图(一) 二维视图(一) 二维视图(二) 二维视图(二) 三维视图 三维视图 5. 无人机控制 控制台控制 控制台控制 智能控制 智能控制 地面站控制 地面站控制 6. 制定飞行任务 飞行任务(一) 飞行任务(一) 飞行任务(二) 飞行任务(二) 飞行任务(三) 飞行任务(三) 二、解决问题 智能无人机路径规划仿真系统解决了普通无人机无法精准规划路径的问题,且普通无人机不够托底,不便控制,难以运用于实际战争。本软件可以预先为飞行任务设计航线

Pass extra arguments to PyQt slot without losing default signal arguments

孤人 提交于 2021-02-05 20:29:22
问题 A PyQt button event can be connected in the normal way to a function so that the function receives the default signal arguments (in this case the button checked state): def connections(self): my_button.clicked.connect(self.on_button) def on_button(self, checked): print checked # prints "True" Or, the default signal arguments can be overridden using lambda : def connections(self): my_button.clicked.connect(lambda: self.on_button('hi')) def on_button(self, message): print message # prints "hi"

How to have a scrollable context menu in PyQt

别说谁变了你拦得住时间么 提交于 2021-02-05 11:51:25
问题 I would like to have a scrollable context menu so that I can place many Actions in it. I saw an answer from another post that setting menu.setStyleSheet('QMenu{menu-scrollable: 1;}') will enable scroll Bar but it doesn't seem to do the job. Here is a demonstration of the context menu of the blender software. How can this be achieved? 回答1: Dealing with menu customization (with any framework) is not an easy task, and from experience I can telly you that trying to use simple approaches such as

Display data from list in label Python

假装没事ソ 提交于 2021-02-05 11:48:26
问题 I have a list of data and the size of list is not fix. I want to display each item of this list in a label(Textview). self.valueT.append(value) for i in self.valueT: // print(i) self.result.setText(i) here in this code the print(i) work that display everything in console mean that it display the result but when I do self.result.setText(i) this one not working mean it did't display anything in the Label. and the second thing i want to display each value after 1sec. self.valueT is a list 回答1: A

Calling a function and having it call multiple times

ⅰ亾dé卋堺 提交于 2021-02-05 11:31:03
问题 I'm having an issue in PyQt5 where if I some of my functions, it calls it however many times I've called it so far. I'll try to water down to relevant code. class MainWindow(QtWidgets.QMainWindow, UI.MainUI.Ui_MainWindow): """The Main Window where everything happens""" def __init__(self, parent=None): """Initializes (Don't use partial as most of the variables aren't created yet)""" super(MainWindow, self).__init__(parent) self.setupUi(self) self.btn_buy_ship.clicked.connect( lambda: self.game

Calling a function and having it call multiple times

此生再无相见时 提交于 2021-02-05 11:27:08
问题 I'm having an issue in PyQt5 where if I some of my functions, it calls it however many times I've called it so far. I'll try to water down to relevant code. class MainWindow(QtWidgets.QMainWindow, UI.MainUI.Ui_MainWindow): """The Main Window where everything happens""" def __init__(self, parent=None): """Initializes (Don't use partial as most of the variables aren't created yet)""" super(MainWindow, self).__init__(parent) self.setupUi(self) self.btn_buy_ship.clicked.connect( lambda: self.game