<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[TypeError with PySide 6.5.0 for multiple inheritance of MainWindow]]></title><description><![CDATA[<p dir="auto">Hi all,<br />
It appears I got a problem after PySide upgrade from 6.4.3 to 6.5.0.<br />
Here is a minimal example - it does nothing special, just displays a window and a label  in it. The structure of the code is similar to the one I use in real project where UI is created with help of Qt Designer generated files.<br />
This code works fine with PySide 6.4.3, but with PySide 6.5.0 it raises an error.<br />
The error:</p>
<pre><code>window = MainWindow()
             ^^^^^^^^^^^^^^^^^
File "main.py", line 11, in __init__
  QMainWindow.__init__(self, parent=None)
TypeError: object.__init__() takes exactly one argument (the instance to initialize)
</code></pre>
<p dir="auto">The code:</p>
<pre><code>from PySide6.QtWidgets import QApplication, QMainWindow, QLabel

class Ui_X_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.resize(400, 300)
        self.lbl = QLabel(self)

class MainWindow(QMainWindow, Ui_X_MainWindow):
    def __init__(self):
        QMainWindow.__init__(self, parent=None)
        self.setupUi(self)
        self.lbl.setText("XXX")

app = QApplication([])
window = MainWindow()
window.show()
app.exec()
</code></pre>
]]></description><link>https://forum.qt.io/topic/144262/typeerror-with-pyside-6-5-0-for-multiple-inheritance-of-mainwindow</link><generator>RSS for Node</generator><lastBuildDate>Wed, 06 May 2026 08:30:04 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/144262.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 09 Apr 2023 14:36:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Fri, 14 Apr 2023 18:27:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> said in <a href="/post/754460">TypeError with PySide 6.5.0 for multiple inheritance of MainWindow</a>:</p>
<blockquote>
<p dir="auto">For the architecture of this particular logger case.  Since you have to derive from logging.Handler, why don't you encapsulate the QPlainTextEdit in your class instead of multiple-inheriting from it?  My initial thought is that would be preferable.  Then you would not multiple-inherit and you wouldn't have the current problem, whatever it is.</p>
</blockquote>
<p dir="auto">Finally I decided to encaplusate <code>logging.Handler</code> in my class and now I like it more than before :)<br />
The bug was confirmed in PySide and to be corrected in future versions but everything works good without multiple inheritance.</p>
<p dir="auto">Also initial code was not ideal and was different from <a href="https://doc.qt.io/qtforpython/tutorials/basictutorial/uifiles.html#option-a-generating-a-python-class" target="_blank" rel="noopener noreferrer nofollow ugc">Qt recommendations</a>.</p>
<p dir="auto">So, with both things changed I have my code up and running again.</p>
]]></description><link>https://forum.qt.io/post/754773</link><guid isPermaLink="true">https://forum.qt.io/post/754773</guid><dc:creator><![CDATA[StarterKit]]></dc:creator><pubDate>Fri, 14 Apr 2023 18:27:18 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Tue, 09 May 2023 16:29:00 GMT]]></title><description><![CDATA[<p dir="auto">I have same problem. The problem for me is that the PySide6.5.0 I installed does not match the python version I used. My python version is 3.10, while the python version for installed PySide is 3.7 when using pip to install.</p>
<p dir="auto">Collecting PySide6<br />
Using cached PySide6-6.5.0-cp37-abi3-win_amd64.whl (7.2 kB)</p>
<p dir="auto">No idea why it use 3.7</p>
]]></description><link>https://forum.qt.io/post/757666</link><guid isPermaLink="true">https://forum.qt.io/post/757666</guid><dc:creator><![CDATA[qqiq]]></dc:creator><pubDate>Tue, 09 May 2023 16:29:00 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Thu, 20 Apr 2023 09:08:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonton">@<bdi>jonton</bdi></a> said in <a href="/post/755505">TypeError with PySide 6.5.0 for multiple inheritance of MainWindow</a>:</p>
<blockquote>
<p dir="auto">I'll put a note on the issue page that you pointed to.</p>
</blockquote>
<p dir="auto">Please do so.  I don't know whether they will say it is a 6.5.0 issue or whether they will say your code is wrong/the behaviour you see is correct.</p>
]]></description><link>https://forum.qt.io/post/755507</link><guid isPermaLink="true">https://forum.qt.io/post/755507</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Thu, 20 Apr 2023 09:08:32 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Thu, 20 Apr 2023 08:59:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a></p>
<p dir="auto">Thanks for all the help with this, it's been invaluable.  I found the root cause of our problem. The order that the base classes are inherited in affects the Method Resolution Order, which confuses the new system.</p>
<p dir="auto">I think it points to an error in PySide 6.5.0, but I don't have enough knowledge of the inner workings of Python and PySide to make a call on this.  I'll put a note on the issue page that you pointed to.</p>
<p dir="auto">The PR to fix this in USD is here, which goes into an explanation of the issue:</p>
<p dir="auto"><a href="https://github.com/PixarAnimationStudios/USD/pull/2392" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/PixarAnimationStudios/USD/pull/2392</a></p>
]]></description><link>https://forum.qt.io/post/755505</link><guid isPermaLink="true">https://forum.qt.io/post/755505</guid><dc:creator><![CDATA[jonton]]></dc:creator><pubDate>Thu, 20 Apr 2023 08:59:00 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Wed, 19 Apr 2023 12:22:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonton">@<bdi>jonton</bdi></a><br />
I would not begin to know the implications of the changes you see.</p>
<p dir="auto">It <em>sounds like</em>:</p>
<ul>
<li>
<p dir="auto">There was a problem with multiple inheritance at 6.4 which they fixed at 6.5, or they just changed/improved it, per the changes.</p>
</li>
<li>
<p dir="auto">Now at 6.5 that may be fixed/improved, but other cases, such as yours and <a class="plugin-mentions-user plugin-mentions-a" href="/user/starterkit">@<bdi>StarterKit</bdi></a>'s, go wrong, where they used to be OK at 6.4.</p>
</li>
</ul>
<p dir="auto">I do not truly understand the discussion in <a href="https://bugreports.qt.io/browse/PYSIDE-2294" target="_blank" rel="noopener noreferrer nofollow ugc">https://bugreports.qt.io/browse/PYSIDE-2294</a> or what the conclusion was.  You may need to post there, or raise a new issue.</p>
<p dir="auto">One thing: I see you use <code>super(QtCore.QObject, self).__init__(self)</code> in both your cases.  But <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> wrote</p>
<blockquote>
<p dir="auto">This is wrong, self shall not be part of the arguments passed to the function called when using super.<br />
super().init(parent=parent)</p>
</blockquote>
<p dir="auto">So is not that the issue?</p>
<p dir="auto">At this point I am passing here, as it's becoming a Python issue I am not sufficiently familiar with.</p>
]]></description><link>https://forum.qt.io/post/755351</link><guid isPermaLink="true">https://forum.qt.io/post/755351</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 19 Apr 2023 12:22:14 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Wed, 19 Apr 2023 11:33:38 GMT]]></title><description><![CDATA[<p dir="auto">I'm certainly having the problem in 6.5.0, whereas the code works in 6.4.3 correctly.</p>
<p dir="auto">It looks like the change that came into 6.5.0 was this:</p>
<p dir="auto"><a href="https://github.com/pyside/pyside-setup/commit/e8095467f7d0332cc0987e7c541de9906e19fece" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/pyside/pyside-setup/commit/e8095467f7d0332cc0987e7c541de9906e19fece</a></p>
<p dir="auto">And this has caused the regression?</p>
]]></description><link>https://forum.qt.io/post/755340</link><guid isPermaLink="true">https://forum.qt.io/post/755340</guid><dc:creator><![CDATA[jonton]]></dc:creator><pubDate>Wed, 19 Apr 2023 11:33:38 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Wed, 19 Apr 2023 11:18:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonton">@<bdi>jonton</bdi></a><br />
It is deffo the same issue! :)  It was reported against 6.4.  I don't understand because I read it as it was "fixed" in both 6.5.0 &amp; 6.6.0, whatever fixing in "both" means, but I think you are saying you are having a problem in 6.5.  I don't know whether that is the original problem <em>OR</em> they did some fix for that which you have, but <em>now</em> you have/that has introduced a (new?) problem with your <code>super()</code> case.</p>
]]></description><link>https://forum.qt.io/post/755337</link><guid isPermaLink="true">https://forum.qt.io/post/755337</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 19 Apr 2023 11:18:46 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Wed, 19 Apr 2023 10:54:32 GMT]]></title><description><![CDATA[<p dir="auto">Thanks <a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a></p>
<p dir="auto">That does sound like the same issue, but as you say it's not clear in the discussion whether there is actually a fix in 6.6.0 or not?</p>
<p dir="auto">I'll check in with them there.</p>
<p dir="auto">Cheers,</p>
<p dir="auto">Jon</p>
]]></description><link>https://forum.qt.io/post/755332</link><guid isPermaLink="true">https://forum.qt.io/post/755332</guid><dc:creator><![CDATA[jonton]]></dc:creator><pubDate>Wed, 19 Apr 2023 10:54:32 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Tue, 18 Apr 2023 19:35:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonton">@<bdi>jonton</bdi></a><br />
There was some "fix" for 6.5.0/6.6.0 in <a href="https://bugreports.qt.io/browse/PYSIDE-2294" target="_blank" rel="noopener noreferrer nofollow ugc">https://bugreports.qt.io/browse/PYSIDE-2294</a>, though I don't know what was "fixed" exactly.<br />
Have you read that one?  Should you comment there?</p>
]]></description><link>https://forum.qt.io/post/755235</link><guid isPermaLink="true">https://forum.qt.io/post/755235</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 18 Apr 2023 19:35:49 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Tue, 18 Apr 2023 19:00:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonton">@<bdi>jonton</bdi></a></p>
<p dir="auto">This makes me think it's a new bug that has been introduced into the handling of multiple inheritance in PySide.</p>
<p dir="auto">I don't know enough about the inner workings of PySide, perhaps someone on this forum can shed some light on it?</p>
]]></description><link>https://forum.qt.io/post/755222</link><guid isPermaLink="true">https://forum.qt.io/post/755222</guid><dc:creator><![CDATA[jonton]]></dc:creator><pubDate>Tue, 18 Apr 2023 19:00:00 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Tue, 18 Apr 2023 17:14:28 GMT]]></title><description><![CDATA[<p dir="auto">We have hit this issue too.  PySide 6.5.0 appears to use the signature of the last super-class that is initialised for both of them.  The example we have is:</p>
<pre><code>    def __init__(self, rootDataModel, parent):
        super(QtCore.QObject, self).__init__(self)
        StateSource.__init__(self, parent, "model")
</code></pre>
<p dir="auto">This results in a runtime error of:</p>
<pre><code>    QtCore.QObject.__init__(self)
TypeError:__init__() missing 2 required positional arguments: 'parent' and 'name'
</code></pre>
<p dir="auto">If I reverse the order of initialisation to:</p>
<pre><code>    def __init__(self, rootDataModel, parent):
        StateSource.__init__(self, parent, "model")
        super(QtCore.QObject, self).__init__(self)
</code></pre>
<p dir="auto">Then the error reports that the <code>StateSource</code> initialiser only should have a single parameter.</p>
]]></description><link>https://forum.qt.io/post/755209</link><guid isPermaLink="true">https://forum.qt.io/post/755209</guid><dc:creator><![CDATA[jonton]]></dc:creator><pubDate>Tue, 18 Apr 2023 17:14:28 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Sun, 16 Apr 2023 10:19:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> said in <a href="/post/754776">TypeError with PySide 6.5.0 for multiple inheritance of MainWindow</a>:</p>
<blockquote>
<p dir="auto">That is indeed the best, but earlier you said</p>
</blockquote>
<p dir="auto">I thought one more time about it and decided that there is a better desing option possible :) Not a big change but I moved 2 more methods inside my class and it looks good after all :)</p>
]]></description><link>https://forum.qt.io/post/754899</link><guid isPermaLink="true">https://forum.qt.io/post/754899</guid><dc:creator><![CDATA[StarterKit]]></dc:creator><pubDate>Sun, 16 Apr 2023 10:19:48 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Fri, 14 Apr 2023 18:32:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/starterkit">@<bdi>StarterKit</bdi></a> said in <a href="/post/754773">TypeError with PySide 6.5.0 for multiple inheritance of MainWindow</a>:</p>
<blockquote>
<p dir="auto">Finally I decided to encaplusate <code>logging.Handler</code> in my class and now I like it more than before :)</p>
</blockquote>
<p dir="auto">That is indeed the best, but earlier you said</p>
<blockquote>
<p dir="auto">But your handler should be a descendant of <code>logging.Handler</code>.</p>
</blockquote>
<p dir="auto">Anyway, sounds good :)</p>
]]></description><link>https://forum.qt.io/post/754776</link><guid isPermaLink="true">https://forum.qt.io/post/754776</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 14 Apr 2023 18:32:47 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Fri, 14 Apr 2023 18:27:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> said in <a href="/post/754460">TypeError with PySide 6.5.0 for multiple inheritance of MainWindow</a>:</p>
<blockquote>
<p dir="auto">For the architecture of this particular logger case.  Since you have to derive from logging.Handler, why don't you encapsulate the QPlainTextEdit in your class instead of multiple-inheriting from it?  My initial thought is that would be preferable.  Then you would not multiple-inherit and you wouldn't have the current problem, whatever it is.</p>
</blockquote>
<p dir="auto">Finally I decided to encaplusate <code>logging.Handler</code> in my class and now I like it more than before :)<br />
The bug was confirmed in PySide and to be corrected in future versions but everything works good without multiple inheritance.</p>
<p dir="auto">Also initial code was not ideal and was different from <a href="https://doc.qt.io/qtforpython/tutorials/basictutorial/uifiles.html#option-a-generating-a-python-class" target="_blank" rel="noopener noreferrer nofollow ugc">Qt recommendations</a>.</p>
<p dir="auto">So, with both things changed I have my code up and running again.</p>
]]></description><link>https://forum.qt.io/post/754773</link><guid isPermaLink="true">https://forum.qt.io/post/754773</guid><dc:creator><![CDATA[StarterKit]]></dc:creator><pubDate>Fri, 14 Apr 2023 18:27:18 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Wed, 12 Apr 2023 14:42:11 GMT]]></title><description><![CDATA[<p dir="auto">Hi all,<br />
So it appears to be a bug introduced in PySide 6.5.0 release that they corrected as result of PYSIDE-2294.</p>
<p dir="auto">But I try to understand how <code>super()</code> works based on information that I collected.<br />
And I'm a bit puzzled now...<br />
Here is my old code:</p>
<pre><code>import logging
from PySide6.QtWidgets import QApplication, QPlainTextEdit

class LogViewer(QPlainTextEdit, logging.Handler):
    def __init__(self, parent=None):
        QPlainTextEdit.__init__(self, parent)     # this line will be changed
        logging.Handler.__init__(self)            # this line will be changed

app = QApplication([])
window = LogViewer()
window.show()
print(f"LEVEL: {window.level}")
app.exec() 
</code></pre>
<p dir="auto">It works and prints <code>LEVEL: 0</code> as expected.<br />
But based on all these discussions I decided to change it and use <code>super()</code> and got this code:</p>
<pre><code>import logging
from PySide6.QtWidgets import QApplication, QPlainTextEdit

class LogViewer(QPlainTextEdit, logging.Handler):
    def __init__(self, parent=None):
        super().__init__(parent=parent)     # this line was changed

app = QApplication([])
window = LogViewer()
window.show()
print(f"LEVEL: {window.level}")
app.exec() 
</code></pre>
<p dir="auto">And this code fails with <code>AttributeError: 'LogViewer' object has no attribute 'level'</code> - it appears that <code>logging.Handler</code> ancestor didn't become a part of <code>window</code> object... I don't understand what is wrong in this case... Any hints?...</p>
<p dir="auto">I played a bit and changed 2nd example to use different class order: <code>class LogViewer(logging.Handler, QPlainTextEdit)</code> and it gave me <code>TypeError: Handler.__init__() got an unexpected keyword argument 'parent'</code> that raises a feeling that something is not right...</p>
]]></description><link>https://forum.qt.io/post/754560</link><guid isPermaLink="true">https://forum.qt.io/post/754560</guid><dc:creator><![CDATA[StarterKit]]></dc:creator><pubDate>Wed, 12 Apr 2023 14:42:11 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Tue, 11 Apr 2023 19:55:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a>, I've created <a href="https://bugreports.qt.io/browse/PYSIDE-2294" target="_blank" rel="noopener noreferrer nofollow ugc">PYSIDE-2294</a> where I try to figure out how my code should look like...<br />
The main strange thing indeed is that everything is fine with 6.4.3 and goes to hell with 6.5.0. I'm not a python master but... it worked pretty well before 6.5.0 even if my code isn't ideal :)</p>
<p dir="auto">With regards to your question about inheritance. I use Qt Designer to create UI layout. So for me it is easier to have Qt-based class that I may use in Qt Designer and simply put an object on form with help of mouse. This is why I inherited from <code>QPlainTextEdit</code>.<br />
I may do it other way around and make another class that would be derived from <code>logging.Handler</code> and then use it as a member of my class. But these two classes will be tightly coupled and won't work one without another.<br />
So... if one way I lose benefits of Qt, another way I have bad design... - and then, why would we have multiple inheritance at all? :) I created this class some time ago and it survived migration from Qt 5 to Qt 6... But now it fails with Qt 6.5.0 :(</p>
]]></description><link>https://forum.qt.io/post/754473</link><guid isPermaLink="true">https://forum.qt.io/post/754473</guid><dc:creator><![CDATA[StarterKit]]></dc:creator><pubDate>Tue, 11 Apr 2023 19:55:38 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Tue, 11 Apr 2023 17:17:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/starterkit">@<bdi>StarterKit</bdi></a></p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> said in <a href="/post/754326">TypeError with PySide 6.5.0 for multiple inheritance of MainWindow</a>:</p>
<blockquote>
<p dir="auto">This is wrong, self shall not be part of the arguments passed to the function called when using super.<br />
super().<strong>init</strong>(parent=parent)</p>
</blockquote>
<p dir="auto">That's what he said.  I'm not sure enough about my Python to answer, maybe no harm in trying :)</p>
<p dir="auto">It would be interesting to know if there is a PyQt6.5.0 and how it handles your existing code.  You say it was working at 6.4.3, I don't know whether the PySide 6.5 is correct or not.</p>
<p dir="auto">For the architecture of this particular logger case.  Since you have to derive from <code>logging.Handler</code>, why don't you <em>encapsulate</em> the <code>QPlainTextEdit</code> in your class instead of multiple-inheriting from it?  My initial thought is that would be preferable.  Then you would not multiple-inherit and you wouldn't have the current problem, whatever it is.</p>
]]></description><link>https://forum.qt.io/post/754460</link><guid isPermaLink="true">https://forum.qt.io/post/754460</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 11 Apr 2023 17:17:24 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Tue, 11 Apr 2023 17:03:59 GMT]]></title><description><![CDATA[<p dir="auto">Should I have</p>
<pre><code>super(QPlainTextEdit, self).__init__(parent)
super(logging.Handler, self).__init__()
</code></pre>
<p dir="auto">instead of:</p>
<pre><code>QPlainTextEdit.__init__(self, parent)
logging.Handler.__init__(self)
</code></pre>
<p dir="auto">?</p>
]]></description><link>https://forum.qt.io/post/754459</link><guid isPermaLink="true">https://forum.qt.io/post/754459</guid><dc:creator><![CDATA[StarterKit]]></dc:creator><pubDate>Tue, 11 Apr 2023 17:03:59 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Tue, 11 Apr 2023 16:56:27 GMT]]></title><description><![CDATA[<p dir="auto">Ok, I found why I my code fails if I use <code>super().__init__()</code>.<br />
It happens because I have the same problem in another place... And I don't have a clear idea how to fix it in an easy way.</p>
<p dir="auto">So, I use python <a href="https://docs.python.org/3/library/logging.html" target="_blank" rel="noopener noreferrer nofollow ugc">logging</a> module in my app. Traditionally it prints messages to a console by default. You may redirect it to file or something else.</p>
<p dir="auto">But you may do whatever you want if you create you own handler and pass it to <code>logging.addHandler()</code> method. But your handler should be a descendant of <code>logging.Handler</code>.</p>
<p dir="auto">So, I use Qt to have GUI and I deciced to put logging output into a Plain text editor.<br />
As result I created a class that is descendant of both - <code>QPlainTextEdit</code> and <code> logging.Handler</code>:</p>
<pre><code>class LogViewer(QPlainTextEdit, logging.Handler):
    def __init__(self, parent=None):
        QPlainTextEdit.__init__(self, parent)
        logging.Handler.__init__(self)
        # Other initialization

    def emit(self, record, **kwargs):
        # log record handling
</code></pre>
<p dir="auto">and then I use it:</p>
<pre><code>self.Logs = LogViewer(parent_widget)
self.logger = logging.getLogger()
self.logger.addHandler(self.Logs)
</code></pre>
<p dir="auto">And as result I have exactly the same prolem <code>TypeError: Level not an integer or a valid string</code> because now it tries to pass <code>parent_widget</code> to <code>logging.Handler</code> constructor.</p>
]]></description><link>https://forum.qt.io/post/754458</link><guid isPermaLink="true">https://forum.qt.io/post/754458</guid><dc:creator><![CDATA[StarterKit]]></dc:creator><pubDate>Tue, 11 Apr 2023 16:56:27 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Tue, 11 Apr 2023 16:14:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> , <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> , thanks for your proposal, but probably my message was not clear enough. I tried this code already and it fails with the same error unfortunately :(</p>
<pre><code>  File "main.py", line 10, in __init__
    super().__init__(parent=None)
TypeError: object.__init__() takes exactly one argument (the instance to initialize)
</code></pre>
<p dir="auto">It only works if I put nothing:</p>
<pre><code>super().__init__()
</code></pre>
<p dir="auto">but... in this case I have a failure in another part of my code... (I'm still looking into it but it appears without <code>parent=None</code> some other widget behaves wrong...)</p>
]]></description><link>https://forum.qt.io/post/754450</link><guid isPermaLink="true">https://forum.qt.io/post/754450</guid><dc:creator><![CDATA[StarterKit]]></dc:creator><pubDate>Tue, 11 Apr 2023 16:14:38 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Mon, 10 Apr 2023 18:35:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> Damn, sorry, corrected.  I thought I remembered Python :)</p>
]]></description><link>https://forum.qt.io/post/754333</link><guid isPermaLink="true">https://forum.qt.io/post/754333</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Mon, 10 Apr 2023 18:35:39 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Mon, 10 Apr 2023 18:27:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> said in <a href="/post/754301">TypeError with PySide 6.5.0 for multiple inheritance of MainWindow</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/starterkit">@<bdi>StarterKit</bdi></a><br />
If you replace your<br />
<code>QMainWindow.__init__(self, parent=None)</code><br />
by<br />
<code>super().__init__(self, parent=None)</code><br />
does it make the problem go away?</p>
</blockquote>
<p dir="auto">This is wrong, <code>self</code> shall not be part of the arguments passed to the function called when using super.</p>
<pre><code>super().__init__(parent=parent)
</code></pre>
]]></description><link>https://forum.qt.io/post/754326</link><guid isPermaLink="true">https://forum.qt.io/post/754326</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 10 Apr 2023 18:27:14 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Mon, 10 Apr 2023 18:39:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/starterkit">@<bdi>StarterKit</bdi></a><br />
If you replace your<br />
<code>QMainWindow.__init__(self, parent=None)</code><br />
by<br />
<code>super().__init__(self, parent=None)</code>  <em>[Should not have <code>self</code> as per <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> below.]</em><br />
does it make the problem go away?</p>
<p dir="auto">If that does not solve, not that you should have to but try omitting the <code>, parent=None</code> in both the <code>QMainWindow</code> and the <code>super()</code> cases.</p>
]]></description><link>https://forum.qt.io/post/754301</link><guid isPermaLink="true">https://forum.qt.io/post/754301</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Mon, 10 Apr 2023 18:39:15 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Mon, 10 Apr 2023 13:54:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> , while I fully support your point of using super() I can't figure out how to fix this exact error with help of it.</p>
]]></description><link>https://forum.qt.io/post/754281</link><guid isPermaLink="true">https://forum.qt.io/post/754281</guid><dc:creator><![CDATA[StarterKit]]></dc:creator><pubDate>Mon, 10 Apr 2023 13:54:09 GMT</pubDate></item><item><title><![CDATA[Reply to TypeError with PySide 6.5.0 for multiple inheritance of MainWindow on Sun, 09 Apr 2023 18:51:08 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I currently don't have a direct answer for this new issue however, the use of <code>super</code> is more common in code designed with Qt for Python. Even more so in Python 3 code bases.</p>
<p dir="auto">You can see some <a href="https://stackoverflow.com/a/24064568/5843716" target="_blank" rel="noopener noreferrer nofollow ugc">good reasons here as to why</a>.</p>
]]></description><link>https://forum.qt.io/post/754207</link><guid isPermaLink="true">https://forum.qt.io/post/754207</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sun, 09 Apr 2023 18:51:08 GMT</pubDate></item></channel></rss>