Skip to content

Commit

Permalink
fix gui doesn't come forward when clicking icon
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderLJX committed Jul 3, 2023
1 parent 16e21a4 commit 0e9181d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from PyQt5.QtWidgets import QApplication, QMainWindow, QRubberBand
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QLabel, QSlider, QCheckBox, QGroupBox, QHBoxLayout, QSpinBox, QTextEdit, QComboBox, QRadioButton
from PyQt5.QtGui import QFont
from PyQt5.QtCore import Qt, QRect, QPoint, QSize, QThread, pyqtSignal
from PyQt5.QtCore import Qt, QRect, QPoint, QSize, QThread, pyqtSignal, QEvent
import pyscreenshot as ImageGrab
import keyboard
import pyperclip
Expand Down Expand Up @@ -168,6 +168,13 @@ def init_ui(self):

self.setLayout(layout)

def changeEvent(self, event):
if event.type() == QEvent.ActivationChange:
if self.isActiveWindow():
self.raise_()
self.activateWindow()
super().changeEvent(event)

def append_console_text(self, text):
self.console.append(text)

Expand Down

0 comments on commit 0e9181d

Please sign in to comment.