isActiveWindow()     判断是否为活跃窗口

在最前面的不一定是活跃窗口

 

app=QApplication(sys.argv)  #创建应用
    w=QWidget()
    w.show()
    w.move(150,100)
    w.setWindowTitle('窗口1')
    w1 = QWidget()
    w1.show()
    w1.move(600,100)
    w1.setWindowTitle('窗口2')

    s=w.isActiveWindow()   #返回窗口的活跃状态
    s1 = w1.isActiveWindow()
    print(s,s1)

    sys.exit(app.exec_())

 

 

是否为活跃窗口

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-20
  • 2022-12-23
  • 2021-07-22
  • 2021-05-30
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案