D
D
Danil2019-08-09 14:28:18
Python
Danil, 2019-08-09 14:28:18

Python,pyqt5 button fires only 1 time, why?

Hello! Please help ...
The code below displays a window with an html page

my_web = QWebEngineView()

def opensite():
    my_web.load(QUrl.fromLocalFile(tesgg2+'.html'))
    my_web.show()

The button itself, which I click on
opfi2.clicked.connect(opensite)
(tesgg2 - changes each time the button is clicked)
The problem is that when I close the my_web window and click the button again, nothing opens. But if the my_web window is not closed and the button is pressed, then everything in the my_web window is perfectly updated ... Why and how to solve it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MechanicZelenyy, 2019-08-09
@MechanicZelenyy

Perhaps the matter is that when the window is closed, the object responsible for the window dies.

P
Pan Propan, 2019-08-09
@mgis

Are you creating the button programmatically or in interface designer?
As a rule, the button has a property, it is either just clickable or wrung out, that is, it retains its position when clicked .. maybe this is your case ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question