enter image description here This function is called when the shortcut pressed
enter image description here This error pops up even though removeTab only takes one int argument according to the PtQt Documentation
I am using PyQt5 to create a simple Notepad application. I am using "CTRL W" to remove tabs and call the function remove tab. The indexed tab should be close instead the error pops up When adding tabs this problem doesn't seem to appear
CodePudding user response:
It looks like you are trying to call the removeTab() function, but you are passing the wrong number of arguments to the function. The removeTab() function expects a single integer argument, which is the index of the tab that you want to remove. However, it looks like you are passing two arguments to the function, which is causing the error.
Here is an example of how you might call the removeTab() function correctly:
# Assume that you have a QTabWidget object called "tabWidget"
# and you want to remove the second tab
# Get the index of the second tab
index = 1
# Remove the tab with the given index
tabWidget.removeTab(index)
In this example, the removeTab() function is called with only one argument, which is the index of the tab that you want to remove. This should avoid the error that you are seeing.