upiwin/scripts/test_clipping.py

27 lines
596 B
Python
Raw Normal View History

# Test of line clipping
import upiwin
2019-12-10 13:10:43 -07:00
print('**GOT HERE 1')
hdc = upiwin.DevCtxt(type='screen')
2019-12-10 13:10:43 -07:00
print('**GOT HERE 2')
hdc.text_color = 0xFFFFFF # white
hdc.rectangle(100, 100, 199, 199)
2019-12-10 13:10:43 -07:00
print('**GOT HERE 3')
clip = hdc.get_clip_rect()
hdc.set_clip_rect(100, 100, 200, 200)
hdc.text_color = 0xFF0000 # red
hdc.move_to(0, 200)
hdc.line_to(200, 0)
hdc.set_clip_rect(clip[0], clip[1], clip[2], clip[3])
msg = {}
while upiwin.get_message(msg):
if msg['message'] == upiwin.WM_HWBUTTONUP:
bn = msg['attrs'][0]
if bn == 4:
print("Quitting the application.")
upiwin.post_quit_message(0)