Sorry for the vague title, couldn't come up with anything more informative %)
What I want is a 5px horizontal panel on the top of the screen that I can draw on (and, possible, handle clicks on too).
One of the following features would be awesome (although I understand it's probably not really possible to combine both of them):
Is it possible to do this in Python?
Thanks.
Yes, it's possible. The "how" part depends on the GUI library you choose for which there are many options, but most people will recommend the following two: wxPython or PySide which is Qt for Python.
PySide has good documentation and tutorials.
What you will want to do is create a QMainWindow instance and set the WindowFlags to your requirements. You probably want the following combination Qt::Window | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint
.
Something like this:
import sys
from PySide.QtCore import *
from PySide.QtGui import *
class Form(QMainWindow):
def __init__(self, parent=None):
super(Form, self).__init__(parent)
self.setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint)
if __name__ == '__main__':
# Create the Qt Application
app = QApplication(sys.argv)
# Create and show the form
form = Form()
form.show()
# Run the main Qt loop
sys.exit(app.exec_())
Note, that there is a limit to the "staying on top" nature of such windows. There are Win32-specific ways to fight it and get even higher, but such requirement would be a design error.