Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dyndlg.py 2.8KB

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