TypeError: argument 1 has unexpected type 'NoneType'
The argument to connect()
should be a function to call, not a call to the function. Use lambda
to call self.INSERT_NOIDUNG()
self.btnDangkithongtin.clicked.connect(lambda: self.INSERT_NOIDUNG(ID,Name,Gender,Birthday))
Type Error: argument 1 has unexpected type 'QPushButton'
You should rename your buttons or funcions.
You've got here method Notepad.temizle() AND button Notepad.temizle
So when you expect to send a message, instead you send a button, which is typeError
Also I can see the same error with other methods
Setting property's property directly in C#
Size
is a structure. Being a ValueType it's immutable. If you change it's property like that, it will only modify an object instance in the stack, not the actual field. In your case AvatarSize
property can only be set using a struct constructor: new Size(20, 20)
.
clicked.connect() Error
The connect()
method expects a callable argument. When you write self.Soft_Memory()
you are making a call to that method, and the result of that call (None
, since you don't explicitly return anything) is what is being passed to connect()
.
You want to pass a reference to the method itself.
self.PB1.clicked.connect(self.Soft_Memory)
TypeError: QTableView(parent: QWidget = None): argument 1 has unexpected type 'int'
You have the following errors.
QTableView does not accept the number of rows or columns in the constructor, so it seems that you have copied code for QTableWidget that does accept it.
A model in Qt is not a array, list, etc. but a class that inherits from QAbstractItemModel.
If you use QTableWidget then you cannot use a model since it already has one by default that cannot be modified.
Considering the above there are 2 possible solutions:
Use QTableView with a model.
labels = [
"Time In",
"Time Out",
"Class",
"Color",
"Specific Attribute",
"Camera Number",
]
view = QTableView(self)
model = QStandardItemModel(0, 6)
view.setModel(model)
model.setHorizontalHeaderLabels(labels)
view.setGeometry(400, 50, 850, 692)
view.resizeRowsToContents()
conn = mariadb.connect(
user="root", password="", host="localhost", port=3306, database="IRIS"
)
cur = conn.cursor()
cur.execute("SELECT * FROM iris_table")
allSQLRows = cur.fetchall()
model.setRowCount(len(allSQLRows))
for i, row_data in enumerate(allSQLRows):
for j, data in enumerate(row_data):
item = QStandardItem()
item.setData(data, Qt.DisplayRole)
model.setItem(i, j, item)Use QTableWidget
labels = [
"Time In",
"Time Out",
"Class",
"Color",
"Specific Attribute",
"Camera Number",
]
view = QTableWidget(0, 6, self)
view.setHorizontalHeaderLabels(labels)
view.setGeometry(400, 50, 850, 692)
view.resizeRowsToContents()
conn = mariadb.connect(
user="root", password="", host="localhost", port=3306, database="IRIS"
)
cur = conn.cursor()
cur.execute("SELECT * FROM iris_table")
allSQLRows = cur.fetchall()
view.setRowCount(len(allSQLRows))
for i, row_data in enumerate(allSQLRows):
for j, data in enumerate(row_data):
item = QTableWidgetItem()
item.setData(Qt.DisplayRole, data)
view.setItem(i, j, item)
Python3, pyqt5: NoneType error when setting value in radioButton connect
connect
looks to me like your typical callback registration function. It expects to get a function or callable, but you're passing in the return value of setInterval
, which is None
.
If you want the radio button to call setInterval
when it is selected, you need to create a function which will call setInterval
, and pass that as the argument to connect
instead. The shortest way to do that is with a lambda.
self.radioButton_1s.clicked.connect(lambda *args: self.setInterval(1))
Text after compile setPort(self, int): argument 1 has unexpected type 'str'
The error is telling you what the problem is. The setPort
method expects an integer. You're passing it the value of a textbox, which is going to be a string. Hence the unexpected type 'str'
error message.
You need to convert the textbox value to an integer before passing it to setPort
.
proxy.setPort(int(textboxproxyportValue))
Related Topics
Scraping Dynamic Content Using Python-Scrapy
Relative Imports - Modulenotfounderror: No Module Named X
How to Print to Stderr in Python
How to Manually Create a Legend
Why Does Assigning to My Global Variables Not Work in Python
How to Open Every File in a Folder
Python: Defining My Own Operators
Extract Images from PDF Without Resampling, in Python
How to Pass a Default Argument Value of an Instance Member to a Method
Moving Matplotlib Legend Outside of the Axis Makes It Cutoff by the Figure Box
Differencebetween 'Same' and 'Valid' Padding in Tf.Nn.Max_Pool of Tensorflow
How to Find All Positions of the Maximum Value in a List
How to Extract All the Emojis from Text
Pandas Dataframe: Replace All Values in a Column, Based on Condition