Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
helloapp.py54 linesDownload Raw Back to app
1##2## helloapp.py3##4##5## A nice, small 'hello world' Pythonwin application.6## NOT an MDI application - just a single, normal, top-level window.7##8## MUST be run with the command line "pythonwin.exe /app helloapp.py"9## (or if you are really keen, rename "pythonwin.exe" to something else, then10## using MSVC or similar, edit the string section in the .EXE to name this file)11##12## Originally by Willy Heineman <wheineman@uconect.net>13 14 15import win32con16import win32ui17from pywin.mfc import afxres, dialog, window18from pywin.mfc.thread import WinApp19 20 21# The main frame.22# Does almost nothing at all - doesnt even create a child window!23class HelloWindow(window.Wnd):24    def __init__(self):25        # The window.Wnd ctor creates a Window object, and places it in26        # self._obj_.  Note the window object exists, but the window itself27        # does not!28        window.Wnd.__init__(self, win32ui.CreateWnd())29 30        # Now we ask the window object to create the window itself.31        self._obj_.CreateWindowEx(32            win32con.WS_EX_CLIENTEDGE,33            win32ui.RegisterWndClass(0, 0, win32con.COLOR_WINDOW + 1),34            "Hello World!",35            win32con.WS_OVERLAPPEDWINDOW,36            (100, 100, 400, 300),37            None,38            0,39            None,40        )41 42 43# The application object itself.44class HelloApp(WinApp):45    def InitInstance(self):46        self.frame = HelloWindow()47        self.frame.ShowWindow(win32con.SW_SHOWNORMAL)48        # We need to tell MFC what our main frame is.49        self.SetMainFrame(self.frame)50 51 52# Now create the application object itself!53app = HelloApp()54 
codekingpro/portable-devtools · Team Ai