closeEvent not running
-
I can only find an instance of
pyuic5.batin an anaconda folder, which I do not use. I was originally runningpyuic5.exe, which returns the error I'm getting. Sorry for not elaborating better. As for 32-bit vs. 64-bit, I have verified everything is 64-bit. -
How did you install PySide2 exactly ?
-
With
pip install pyside6(I use PySide6 but I was told they were the same but with more features so I'm not sure it matters) -
With
pip install pyside6(I use PySide6 but I was told they were the same but with more features so I'm not sure it matters)@DoubleFelix
PySide6 is not the same as PySide2, hence the6instead of2! It's PySide for Qt6, instead of for Qt5. It's new. It does not yet have all features either.And I notice you are running
pyuic5, which I assume from the5is for Qt5.Anyway, if it were me, I would scrub (uninstall, remove) anything Qt6/PySide6, and install Qt 5.15-ish (latest) + PySide2. (If the PySide2 comes with its own version of Qt5 [I don't know if that's how it works] that's fine, you don't need to do Qt5 separately.) And try again, at least to see how that fares in comparison.
-
Is it your system pip ? Conda ?
-
@JonB I have uninstalled PySide6 and installed PySide2 and I get the same error.
@SGaist I don't think it is but I'm not sure how to tellI attempted to use a mix of PySide6's normal features with PyQt5's
uicmodule, but usingclass TexasHoldEmServerWindow(QMainWindow): def __init__(self): super(TexasHoldEmServerWindow, self).__init__() uic.loadUi(os.path.join(os.path.dirname(__file__), "window.ui"), self)Raises this error:
Exception has occurred: TypeError ('Wrong base class of toplevel widget', (<class 'topaz.server.texas_hold_em.server_window.TexasHoldEmServerWindow'>, 'QMainWindow')) -
Isn't the original base widget a QWidget ?
-
I tried using that too but it throws the same error
-
Then what base class did you select in designer ?
-
The main window is
QMainWindowbut I have a layout inside the window (grid) which isQWidget. Inheriting either gives the same error however. -
I was able to get it working by using
pyuic6 window.ui -o window.py
I have this:super(TexasHoldEmServerWindow, self).__init__() self.window = Ui_MainWindow self.window.setupUi(self)But
setupUi()also needs to passed a parameter called MainWindow, but I'm not sure what to give it here. -
I got it sort of working using a bit of code someone put in a stack overflow post:
from PySide6.QtCore import QMetaObject from PySide6.QtUiTools import QUiLoader class UiLoader(QUiLoader): def __init__(self, baseinstance, customWidgets=None): QUiLoader.__init__(self, baseinstance) self.baseinstance = baseinstance self.customWidgets = customWidgets def createWidget(self, class_name, parent=None, name=''): if parent is None and self.baseinstance: return self.baseinstance else: if class_name in self.availableWidgets(): widget = QUiLoader.createWidget(self, class_name, parent, name) else: try: widget = self.customWidgets[class_name](parent) except (TypeError, KeyError) as e: #raise Exception('No custom widget ' + class_name + ' found in customWidgets param of UiLoader __init__.') pass if self.baseinstance: setattr(self.baseinstance, name, widget) return widget def loadUi(uifile, baseinstance=None, customWidgets=None, workingDirectory=None): loader = UiLoader(baseinstance, customWidgets) if workingDirectory is not None: loader.setWorkingDirectory(workingDirectory) widget = loader.load(uifile) QMetaObject.connectSlotsByName(widget) return widgetThen I add this to my UI Class:
QMainWindow.__init__(self) loadUi(os.path.join(os.path.dirname(__file__), "window.ui"), self)But it keeps saying the widget creation fails.
-
Wait, this is related to another issue. This one is solved.
Sorry for being such a pain and thank you so much.I don't know how to close this
-
Wait, this is related to another issue. This one is solved.
Sorry for being such a pain and thank you so much.I don't know how to close this
@DoubleFelix said in closeEvent not running:
I don't know how to close this
AFAIK, you can't close the thread however you can either delete your post or post a link to the new thread.