表示時に UI 全体が wx.MessageDialog
フリーズし、マウス ポインタだけが移動し、画面上の何もクリックできなくなります。端末からプロセスを強制終了する必要があります。
これは、カラー ピッカーやはい/いいえなどのすべてのダイアログで発生します。ただし、ファイルセレクター用ではありません。
スレッドの詳細:別のフレームCallLater
で発生する があります。
問題のある部分と問題のある行は次のとおりです。
def append_data_point(self, data):
c, l, r = data
if not self._spectrum_data.data_present:
print "hey no data"
dlg = wx.MessageDialog(
parent = self,
message = "data not loaded, create a new data",
caption = "no data loaded" ,
style = wx.OK)
print "created dialog"
dlg.ShowModal()
print "showed modal" #THIS NEVER RUNS
dlg.Destroy()
上記の関数はたまたま特定のボタンにバインドされています。
self.btn_open_file.Bind(wx.EVT_BUTTON, self.open_file)
ファイルの選択 (もちろん、OS インターフェイスから) は機能します。
def open_file(self, event):
dlg = wx.FileDialog(
parent = self,
message = "select a spectrum file",
wildcard = "*.spectrum",
style = wx.OPEN)
if dlg.ShowModal() == wx.ID_OK: #PERDECTLY OK
chosen_file = dlg.GetFilename()
chosen_dir = dlg.GetDirectory()
filepath = os.path.join(chosen_dir, chosen_file)