GUI
GUI的开发 qt开发相关 python 与 C++
廷益--飞鸟
这个作者很懒,什么都没留下…
展开
-
pyqt5 pycharm 配置QTDesigner pyuic
一、配置QTDesigner(qt UI设计)1.打开设置界面2.选择外联工具3.添加QTDesigner工具Name一般取QtDesignerprogram: designer.exe路径路径需要根据自己安装情况 设置一般路径为:\anaconda3\Library\binWorking directory: 打开路径(项目文件夹路径)$ProjectFileDir$点击确认 设置完成4.使用(设置完成可能需要重启 pycharm)5.打开二原创 2021-03-24 16:45:05 · 344 阅读 · 0 评论 -
pyqt5 已有工程 添加新对话框
1、qt添加对话框与关联文件项目工程右键同时创建UI与对应的类文件(.h, .cpp)选择创建的模板修改对话框名字2、修改批处理文件添加拷贝与编译copy .\Interferogram\NewDialog.ui NewDialog.uiC:\Users\DELL\anaconda3\envs\tf20\Scripts\pyuic5 -o ui_NewDialog.py NewDialog.ui完整文件echo off rem 拷贝ui文件至本目录copy .\Inter原创 2021-03-02 16:09:40 · 332 阅读 · 1 评论 -
pyqt5 关闭对话框 事件
在关闭对话框时,调用的事件重写事件def closeEvent(self, event): 具体代码class QmyDialog(QWidget, Ui_NumPrdictDlg): def closeEvent(self, event): print('关闭对话框') reply = QtWidgets.QMessageBox.question(self,原创 2021-02-23 15:41:26 · 2066 阅读 · 0 评论 -
python pyqt5 打开文件夹 读取文件列表
成员变量初始化 def __init__(self, parent=None): super().__init__(parent) self.file_paths = [] # 文件列表 self.file_index = 0 # 文件索引导入文件夹 # 导入文件夹 @pyqtSlot() def on_btnImportFolder_clicked(self): cur_dir = QDir.c.原创 2021-01-26 17:54:05 · 8235 阅读 · 1 评论 -
python PyQt5 创建工程
1 创建qt工程设置工程路径: 可以浏览修改工程名字:自定义工程名字 当前工程yolo_ui设置编译环境 当前选择qmake类名: 定义一个对话框名字基类:QDialog 基于对话框的工程中英文选择选择有效的QT 运行环境2、创建批处理文件根据路径设置 拷贝路径以及文件名编译环境 以及编译的文件名copy ui文件路径 ui当前路径文件名pyqt编译环境路径 -o ui编译后的文件名 ui文件名字echo off rem 拷贝ui文件原创 2021-01-20 10:37:32 · 786 阅读 · 2 评论 -
python pyqt 显示opencv图片
读取图片存放于self.img_org 图片数据添加标签 labelImage 显示图片容器显示彩色图片def dis_img(self): # BGR => RGB 文件格式 shrink = cv2.cvtColor(self.img_org, cv2.COLOR_BGR2RGB) # cv 图片转换成 qt图片 qt_img = QtGui.QImage(shrink.data, # 数据源原创 2020-11-09 16:36:43 · 4202 阅读 · 1 评论 -
python pyqt 输入框的使用
代码实现import sysfrom PyQt5.QtCore import *from PyQt5.QtWidgets import *from ui_Dialog import Ui_Dialog# 创建对话框类 并继承UI类class QmyDialog(QWidget, Ui_Dialog): def __init__(self, parent=None): super().__init__(parent) self.ui = Ui_D..原创 2020-11-09 16:22:46 · 3140 阅读 · 2 评论 -
Python PyQt5 添加响应事件(信号&槽)
1、打开Qt Creator双击QT工程文件(.pro) 打开 [Qt Creator]注意:不要在文件夹中 双击.ui文件2、选择控件(按钮)选择一个控件 目前以按钮 (清空)选中清空 点击[右键]3、选择信号(slot)不同类型的控件可选的 信号,不一样。从中选择需要的信号,然后点击【OK】按钮在 .h 与.cpp自动添加 函数4、拷贝生成函数 至 python...原创 2020-04-24 10:25:22 · 5305 阅读 · 0 评论 -
Python GUI 输入框的使用方法
Python GUI 输入框的使用方法from tkinter import *def printInfo(): """打印输入的 用户名和密码""" print("Account:%s \npassword:%s" % (accountE.get(), pwdE.get())) accountE.delete(0, END) pwdE.delete(0,...原创 2020-04-02 11:24:27 · 6773 阅读 · 0 评论 -
python GUI pack方法
python GUI pack方法from tkinter import *root = Tk()root.title("pack方法")root.geometry("300x180")print("执行前", root.pack_slaves())ok_label = Label(root, text="OK", font="Times 20 b...原创 2020-03-14 09:40:55 · 1929 阅读 · 0 评论 -
python GUI与内联函数
python GUI与内联函数全局变量from tkinter import *counter = 0digit = Nonedef counting(): global counter global digit counter += 1 # 重新设置 text digit.config(text=str(counter)) # 1秒...原创 2020-03-12 09:47:09 · 219 阅读 · 0 评论 -
python GUI 显示图片与文字
python GUI 显示图片与文字from tkinter import *from PIL import Image, ImageTkimport tkinter.font as tfroot = Tk()root.title("ch2_20")# 1.显示文本sse_text = """皇家马德里足球俱乐部(Real Madrid Club de Fútbol,中文简称为...原创 2020-03-11 14:31:03 · 2662 阅读 · 0 评论 -
python GUI tkinter基本概念
python GUI tkinter基本概念from tkinter import *def main(): # 当前版本 print("tkinter 版本:", TkVersion) # 1,创建根图片 root = Tk() # 2.获取计算窗口 宽度,长度,显示位置X,Y screen_width = root.winfo_scr...原创 2020-03-10 15:01:50 · 163 阅读 · 0 评论 -
QT main.cpp调用结构
QT 自动创建的main.cpp文件#include "samp2_1.h"#include <QtWidgets/QApplication>int main(int argc, char *argv[]) //程序入口函数{ QApplication a(argc, argv); //创建应用程序对象; samp2_1 w; //创建窗口对象; w.sho...原创 2020-04-16 13:31:11 · 582 阅读 · 0 评论