Pythonの入門動画にIronPythonが出てきました。
その中で「ファイルを開く」ダイアログボックスを表示するんですが
動画と同じようコードを写しても動作しません。
py
1# -*- coding: utf-8 -*- 2 3import clr 4clr.AddReference("System.Windows.Forms") 5from System.Windows.Forms import OpenFileDialog, DialogResult 6 7dialog = OpenFileDialog() 8dialog.Filter = "Python Script(*.py)|*.py" 9 10result = dialog.ShowDialog() 11 12if result == DialogResult.OK: 13 print("file selected: " + dialog.FileName) 14else: 15 print("file was not selected")
あなたの回答
tips
プレビュー