Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 22, 2023. It is now read-only.
/pythonnetPublic archive
forked frompythonnet/pythonnet

Commite85a255

Browse files
committed
Merge pull requestpythonnet#198 from tonyroberts/develop
Start the wordpad demo in an STA thread.
2 parents53bd058 +9f562be commite85a255

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

‎demo/wordpad.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
importclr
1111
importSystem.Windows.FormsasWinForms
12+
fromSystem.ThreadingimportThread,ThreadStart,ApartmentState
1213
fromSystem.DrawingimportColor,Size,Point
1314
fromSystem.TextimportEncoding
1415
fromSystem.IOimportFile
@@ -420,12 +421,19 @@ def OnClickClose(self, sender, args):
420421
self.Close()
421422

422423

423-
424-
defmain():
424+
defapp_thread():
425425
app=Wordpad()
426426
WinForms.Application.Run(app)
427427
app.Dispose()
428428

429+
430+
defmain():
431+
thread=Thread(ThreadStart(app_thread))
432+
thread.SetApartmentState(ApartmentState.STA)
433+
thread.Start()
434+
thread.Join()
435+
436+
429437
if__name__=='__main__':
430438
main()
431439

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp