As I call a method of a Qtgui.Qmainwindow class, within another Qobject class in python

Asked

Viewed 155 times

1

I have a class:

class MyWindow2Class(QtGui.QMainWindow, form2_class):

within the init I have this piece of code:

self.scr = ScriptManager(self)
self.qwebview.page().mainFrame().addToJavaScriptWindowObject("obj", self.scr)
self.qwebview.load(QtCore.QUrl('pagina.html'))
self.btnEnviar.clicked.connect(self.btnEnviar_clicked)

And I have the following method:

def btnEnviar_clicked(self):

In the javascript of the page I call

obj.Enviar();

And in class Scriptmanager has a method

def Enviar(self):

How do I make the method Send in that class Scriptmanager call the btnEnviar_clicked, when javascript calls the object..

I tested and if I give one print for example in class Send, works fine, but I haven’t figured out how to call a method within the parent class..
I tried the super(ScriptManager, self).btnEnviar_clicked()
But it makes a mistake and it doesn’t work..

1 answer

0

I managed to solve. Just create the class within the class, and use any function to start and send the Parent inside the :) subclass solved

  • 1

    Post part of the code that solved the problem, so you will be collaborating for future research!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.