File: demo01.py

package info (click to toggle)
python-wpy 0.53-0.1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 832 kB
  • ctags: 1,991
  • sloc: python: 8,624; makefile: 57; sh: 24
file content (32 lines) | stat: -rwxr-xr-x 843 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /usr/local/bin/python

import wpy

class MyView(wpy.CScrollView):
  def OnCreate(self, event):
    b = wpy.CPushButton(self, "Quit")
    self.button = b
    b.Create()
  def OnSize(self, rect):
    self.button.WpyPlace(rect, 0.5, 0.8, "s")
  def OnDraw(self, DC):
    pad = DC.wpyOneMeter * 5 / 1000
    DC.DrawText("Hello World", pad, pad)

class MyFrame(wpy.CFrameWnd):
  def __init__(self):
    wpy.CFrameWnd.__init__(self)
    self.wpySizeX = self.wpyScreenSizeX / 2
    self.wpySizeY = self.wpyScreenSizeX / 4

class MyApp(wpy.CWinApp):
  def InitInstance(self):
    templ = wpy.CSingleDocTemplate(wpy.CDocument, MyFrame, MyView)
    templ.wpyText = "Usual Hello World Demo"
    self.AddDocTemplate(templ)
    self.FileNew()
  def OnButtonQuit(self, control):
    self.Exit()

# Start the application, respond to events.
app = MyApp()