Spaces:
Sleeping
Sleeping
File size: 2,829 Bytes
d12bc25 |
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# dyndlg.py
# contributed by Curt Hagenlocher <[email protected]>
# Dialog Template params:
# Parameter 0 - Window caption
# Parameter 1 - Bounds (rect tuple)
# Parameter 2 - Window style
# Parameter 3 - Extended style
# Parameter 4 - Font tuple
# Parameter 5 - Menu name
# Parameter 6 - Window class
# Dialog item params:
# Parameter 0 - Window class
# Parameter 1 - Text
# Parameter 2 - ID
# Parameter 3 - Bounds
# Parameter 4 - Style
# Parameter 5 - Extended style
# Parameter 6 - Extra data
import win32con
import win32ui
from pywin.mfc import dialog, window
def MakeDlgTemplate():
style = (
win32con.DS_MODALFRAME
| win32con.WS_POPUP
| win32con.WS_VISIBLE
| win32con.WS_CAPTION
| win32con.WS_SYSMENU
| win32con.DS_SETFONT
)
cs = win32con.WS_CHILD | win32con.WS_VISIBLE
dlg = [
["Select Warehouse", (0, 0, 177, 93), style, None, (8, "MS Sans Serif")],
]
dlg.append([130, "Current Warehouse:", -1, (7, 7, 69, 9), cs | win32con.SS_LEFT])
dlg.append([130, "ASTORIA", 128, (16, 17, 99, 7), cs | win32con.SS_LEFT])
dlg.append([130, "New &Warehouse:", -1, (7, 29, 69, 9), cs | win32con.SS_LEFT])
s = win32con.WS_TABSTOP | cs
# dlg.append([131, None, 130, (5, 40, 110, 48),
# s | win32con.LBS_NOTIFY | win32con.LBS_SORT | win32con.LBS_NOINTEGRALHEIGHT | win32con.WS_VSCROLL | win32con.WS_BORDER])
dlg.append(
[
"{8E27C92B-1264-101C-8A2F-040224009C02}",
None,
131,
(5, 40, 110, 48),
win32con.WS_TABSTOP,
]
)
dlg.append(
[128, "OK", win32con.IDOK, (124, 5, 50, 14), s | win32con.BS_DEFPUSHBUTTON]
)
s = win32con.BS_PUSHBUTTON | s
dlg.append([128, "Cancel", win32con.IDCANCEL, (124, 22, 50, 14), s])
dlg.append([128, "&Help", 100, (124, 74, 50, 14), s])
return dlg
def test1():
win32ui.CreateDialogIndirect(MakeDlgTemplate()).DoModal()
def test2():
dialog.Dialog(MakeDlgTemplate()).DoModal()
def test3():
dlg = win32ui.LoadDialogResource(win32ui.IDD_SET_TABSTOPS)
dlg[0][0] = "New Dialog Title"
dlg[0][1] = (80, 20, 161, 60)
dlg[1][1] = "&Confusion:"
cs = (
win32con.WS_CHILD
| win32con.WS_VISIBLE
| win32con.WS_TABSTOP
| win32con.BS_PUSHBUTTON
)
dlg.append([128, "&Help", 100, (111, 41, 40, 14), cs])
dialog.Dialog(dlg).DoModal()
def test4():
page1 = dialog.PropertyPage(win32ui.LoadDialogResource(win32ui.IDD_PROPDEMO1))
page2 = dialog.PropertyPage(win32ui.LoadDialogResource(win32ui.IDD_PROPDEMO2))
ps = dialog.PropertySheet("Property Sheet/Page Demo", None, [page1, page2])
ps.DoModal()
def testall():
test1()
test2()
test3()
test4()
if __name__ == "__main__":
testall()
|