[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: Can't call another class
From:       paparucino <paparucino () gmail ! com>
Date:       2021-09-13 14:30:05
Message-ID: aade2404-fa57-5531-5310-d0b0d41e3a87 () gmail ! com
[Download RAW message or body]

Hi, I'm trying to use your script. I had just given it a look on Friday 
and certainly I was hasty in issuing sentences.
Regardless of everything, which we will eventually talk about later, I 
would like to understand why (running the program in standalone) if I 
leave uic.loadUi ('tables.ui', self) everything works perfectly,
but if I use the ui -> derivative py () Ui_MainWindow.setupUi (self,) 
what I get is setupUi () missing 1 required positional argument: 
'MainWindow', which is making me damn.
According to my logic, 'MainWindow' is declared in both files, ui and 
py, so it should be available to the calling script either way. Why 
isn't it in the second?

Coming to your script. Calling it from another script, of course, does 
not pass by def init ... and therefore all the graphics are not initialized.
Therefore
class Main_S_Window (QtWidgets.QMainWindow):
'' '
     def __init __ (self, year, month, cursor, tableCount = 10):
         super () .__ init __ ()
uic.loadUi ('tables.ui', self)
         self.addTables (tableCount)
         self.addTableButton.clicked.connect (lambda: self.addTable ())
'' '
     def addTables (self, year, month, cursor, count = 10):
         Ui_MainWindow.setupUi (self,)
         for i in range (1.10):
             self.addTable ()

and I get the Missing MainWindow error
if instead

def addTables (self, year, month, cursor, count = 10):
         self.setupUi (self,)
         for i in range (1.10):
             self.addTable ()

   File "/root/PycharmProjects/ForTestOnly/maurizio.py", line 55, in 
addTables
     self.setupUi (self,)
AttributeError: 'str' object has no attribute 'setupUi'

and here the confusion increases again because I can't figure out where 
it gets 'str' from since I'm calling a function
I am literally in mental confusion

Regards

paparucino


On 9/10/21 6:59 AM, Maurizio Berti wrote:
>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic