Created
August 20, 2012 16:22
-
-
Save tgck/3405485 to your computer and use it in GitHub Desktop.
simple window initialization in PyObjC (python)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple window initialization in PyObjC | |
import objc | |
from AppKit import * | |
from Foundation import * | |
from PyObjCTools import AppHelper | |
app = NSApplication.sharedApplication() | |
size = NSMakeRect(0.0, 0.0, 400.0, 400.0) # left-end-pos, bottom-end-pos, width, height | |
window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(size,NSTitledWindowMask | NSClosableWindowMask |NSResizableWindowMask | NSMiniaturizableWindowMask, NSBackingStoreBuffered,False) | |
window.setLevel_(3) | |
window.contentView() | |
window.display() | |
window.orderFrontRegardless() | |
AppHelper.runEventLoop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
window.setIgnoresMouseEvents_(YES) #マウスに反応しないウィンドウ
window.setLevel_(-2147483628) # -2147483628 = kCGDesktopWindowLevel -5
→ デスクトップアイコンと壁紙の中間にウィンドウを配置
※この状態でScreenSaverEngine -background すると、当ウィンドウもスクリーンセーバに置き換えられることから、すでに壁紙の領域のもよう