Qt6 bindings for Python programming language. This allows programmers to make Qt6 graphical user interfaces using Python syntax.
Questions tagged [pyqt6]
739 questions
0
votes
1 answer
How to store a string of QLineEdit and to be able to add the stored string to the QLineEdit with a QPushButton?
I'm in the process of implementing an 'ANS' button for my calculator that adds the last calculated result to the QLineEdit. I planned to have a self.stored = '' variable and then have it changed every time the calculate signal is called. But I don't…

JA23Z
- 25
- 5
0
votes
1 answer
How do I make a QPushButton play a sound at the same time as it adds a text to my QLineEdit?
I'm running PyQt6. I have a QMainWindow with one QPushButton and QLineEdit in a widget. I want to play a sound every time I click the button, and simuatenously it adds a text to my line edit. I used playsound to achieve this effect, but there's a…

JA23Z
- 25
- 5
0
votes
0 answers
1 stacked widget is larger than a 2nd, how do I set the fixed size of each widget?
I am trying to create a calculator that can switch from a basic calculator to a scientific calculator. I've been advised to use stacked widgets to layout the buttons. But I'm encountering a problem when switching between the widgets.
The size of the…

JA23Z
- 25
- 5
0
votes
1 answer
How do I add/remove a layout when triggering action in PyQt6? How do I change the order of a layout?
I'm in the process of making a calculator for a project, and I wanted it so that if I press an action in the menu bar it turns into a scientific calculator, and if I uncheck it, it goes back to a basic calculator.
So far I was able to successfully…

JA23Z
- 25
- 5
0
votes
1 answer
How to move multiple lines at once up or down in PyQt List Widget?
I am using the following code to move a single item up in the PyQt6 list widget
def move_item_up_in_list_box(self):
row = self.listWidget.currentRow()
text = self.listWidget.currentItem().text()
self.listWidget.insertItem(row-1, text)
…

Jack Zero
- 77
- 6
0
votes
1 answer
Why Do I get a Stack Overflow error when using setCharFormat()?
I am writing a method, show_spelling_errors(), that loops through custom objects kept in a list self.tokens and uses properties of each object to change the color of some font in a Qt TextEdit widget. show_spelling_errors() is called by another…

mpotapenko
- 3
- 2
0
votes
0 answers
What is the value of this enum type in Pyqt6?
Recently switched to Pyqt6 databases and can't figure out the value of this enum type:
model.setEditStrategy(QtSql.QSqlTableModel.OnFieldChange)
I've tried:
Passing in the numerical value of the enum type ie 0. The interpreter complains saying…

user1801060
- 2,733
- 6
- 25
- 44
0
votes
1 answer
Copy multiple images to clipboard
I have multiple JPG files in a folder. I want to copy all of them to clipboard in one go, so when I press ctrl+v I can paste them.
Shutil will copy and past files from dict to dict:
from PyQt6 import QtCore, QtGui
for _ in range(10):
app =…

Akali DZ
- 47
- 6
0
votes
1 answer
PyQt6 confused about nesting layouts or widgets
I'm trying to understand how nesting of layouts and widgets work so I took out all of the initializer arguments and used .setWhatever instead, .setParent, .setText, and so on. This worked except for the second and third of the QtWidgets.QVBoxLayout…

lumpynose
- 967
- 4
- 12
0
votes
0 answers
Register inherited QObject's meta object to QJSEngine
I would like to inherit the QObject class, and register the inherited class's meta object to a QJSEngine instance, so that I can call let instance = new TrialObject(); in JavaScript. Here is my code:
from PyQt6.QtQml import QJSEngine
from…

SamG101
- 488
- 1
- 7
- 18
0
votes
1 answer
Crop image to circle shape for PyQt
I am creating a simple application with PyQt6. I want to my code to automatically crop the selected image into circle shape. How can I do that? Please help
user14965326
-1
votes
1 answer
pyqt6 subprocess.run function always returns the same value even if the caps lock status changes
Since the keyboard indicator widget cannot be run on my kali system, I decided to write one myself using pyqt. I found that it would be normal if I separated the program and ran it, but not with pyqt6. It runs normally on Windows, but a very strange…

Sepu Ling
- 1
- 2
-1
votes
0 answers
PyQt6 label text dont change
I created gui with qt editor and ı transform to py file but when ı try change label nothing happens.
My Code:
import sqlite3
from PySide6.QtWidgets import QApplication, QWidget
import sys
import random
from ui_form import Ui_Widget
class…

LordKurtu
- 1
- 2
-1
votes
0 answers
Traceback Error: media = QMediaPlayer.Media(QMediaContent(video_url)) AttributeError: type object 'QMediaPlayer' has no attribute 'Media'
While creating a MediaPlayer file in PyQt6 using Qt6 designer. Facing the problem with QMediaConent file.
QMediaContent module is not active so that it can be used and it's giving error.
Traceback (most recent call last):
File "filenam.py", line 32,…

Deepti
- 1
- 1
-1
votes
0 answers
Python PyQt6 dataChanged.emit Function
I am trying to run some PyQt6 Model/View Tutorial.
I can't get the dataChange function to work. I tried everything from the web.
model.py
COLS = 3
ROWS = 2
class MyModel(QAbstractTableModel):
editCompleted = pyqtSignal(str)
def…

Benny Lutin
- 11
- 4