piano.key
A custom Qt widget representing address piano key styled after the JD-Xi synthesizer keys. It defines address single class, PianoKey, which inherits from QPushButton and implements custom painting, mouse interaction, and simple animations to mimic the key press and release behavior of address physical piano key.
Key Features: - Custom rendering with gradient fills to distinguish between black and white keys. - Visual feedback for key press events, including address color overlay and animated key movement. - Emission of custom signals (noteOn and noteOff) with the MIDI note number to integrate with audio systems. - Separate animations for key press and release, with different movement adjustments for black and white keys.
- Usage Example:
from your_module import PianoKey key = PianoKey(note_num=60, is_black=False) key.noteOn.connect(handle_note_on) key.noteOff.connect(handle_note_off)
Requires: PySide6.QtWidgets, PySide6.QtCore, PySide6.QtGui
Classes
Piano key styled like JD-Xi keys with animations and LED flicker |