Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import keyboard
- from PyQt5.QtCore import Qt
- from PyQt5.QtWidgets import QApplication, QLabel, QMainWindow
- class MainWindow(QMainWindow):
- def __init__(self):
- super().__init__()
- self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
- self.setGeometry(100, 100, 64, 64)
- self.setAttribute(Qt.WA_TranslucentBackground)
- self.setStyleSheet("background: transparent;")
- self.muted = False
- self.label = QLabel("Unmuted", self)
- self.label.setAlignment(Qt.AlignCenter)
- self.label.setStyleSheet("color: white; font: bold 20px;")
- self.setCentralWidget(self.label)
- keyboard.add_hotkey('alt+m', self.toggle_mute)
- keyboard.add_hotkey('alt+q', self.quit)
- def toggle_mute(self):
- self.muted = not self.muted
- if self.muted:
- self.label.setText("Muted")
- else:
- self.label.setText("Unmuted")
- def quit(self):
- keyboard.remove_hotkey('alt+m')
- keyboard.remove_hotkey('alt+q')
- self.close()
- if __name__ == '__main__':
- app = QApplication(sys.argv)
- main_window = MainWindow()
- main_window.show()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement