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.

GetSaveFileName.py 1.2KB

1 year ago
12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import os
  2. import win32con
  3. import win32gui
  4. filter = "Python Scripts\0*.py;*.pyw;*.pys\0Text files\0*.txt\0"
  5. customfilter = "Other file types\0*.*\0"
  6. fname, customfilter, flags = win32gui.GetSaveFileNameW(
  7. InitialDir=os.environ["temp"],
  8. Flags=win32con.OFN_ALLOWMULTISELECT | win32con.OFN_EXPLORER,
  9. File="somefilename",
  10. DefExt="py",
  11. Title="GetSaveFileNameW",
  12. Filter=filter,
  13. CustomFilter=customfilter,
  14. FilterIndex=1,
  15. )
  16. print("save file names:", repr(fname))
  17. print("filter used:", repr(customfilter))
  18. print("Flags:", flags)
  19. for k, v in list(win32con.__dict__.items()):
  20. if k.startswith("OFN_") and flags & v:
  21. print("\t" + k)
  22. fname, customfilter, flags = win32gui.GetOpenFileNameW(
  23. InitialDir=os.environ["temp"],
  24. Flags=win32con.OFN_ALLOWMULTISELECT | win32con.OFN_EXPLORER,
  25. File="somefilename",
  26. DefExt="py",
  27. Title="GetOpenFileNameW",
  28. Filter=filter,
  29. CustomFilter=customfilter,
  30. FilterIndex=0,
  31. )
  32. print("open file names:", repr(fname))
  33. print("filter used:", repr(customfilter))
  34. print("Flags:", flags)
  35. for k, v in list(win32con.__dict__.items()):
  36. if k.startswith("OFN_") and flags & v:
  37. print("\t" + k)