Dialogs
In wxPython you can use predefined dialogs or create your own dialogs. You can also create dialog based applications.
The example shows a skeleton of a dialog based application in wxPython.
ダイアログ
wxPythonにおいて、あなたはあらかじめ定義されているダイアログを使ったり、自身でダイアログを作ることができる。 ダイアログベースのアプリケーションを作ることもできる。
(wxPythonにおいて)ダイアログベースのアプリケーションの骨格を示す。
1 #!/usr/bin/python 2 # simpledialog.py 3 4 import wx 5 6 class MyDialog(wx.Dialog): 7 def __init__(self, parent, id, title): 8 wx.Dialog.__init__(self, parent, id, title) 9 10 class MyApp(wx.App): 11 def OnInit(self): 12 dia = MyDialog(None, -1, "simpledialog.py") 13 dia.ShowModal() 14 dia.Destroy() 15 return True 16 17 app = MyApp(0) 18 app.MainLoop()
Notice that you cannot resize the dialog window. The Destroy() method is necessary. It deletes the dialog from the memory. Otherwise, the script would not exit properly.
注意する点として、ダイアログウィンドウはリサイズできない。Destroy()関数も必要だ。Destroy関数はメモリーからダイアログを消去する。それがないと、そのスクリプトはちゃんと終了しないかもしれない。
There are two types of dialogs. Modal and modeless. Modal dialog does not allow a user to work with the rest of the application until it is destroyed. Modal dialogs are created with the ShowModal() method. Dialogs are modeless when called with Show().
モーダルダイアログとモードレスダイアログという二種類のダイアログがある。 モーダルダイアログはダイアログが消滅するまでそのアプリケーションをユーザーが操作するのを許さない。 モーダルダイアログはShowModal()関数で作成する。 Show()l関数が呼ばれた時はモードレスダイアログとなる。