もっといい書き方がないか考えてみました。以下に示す現在のコードは機能します。もっと良い方法がないか考えてみました。
これは検証用です。そのため、if ステートメントはすべての必須フィールドをチェックし、それらが受け入れられる場合は、実行コードに進みます。問題が発生したのは、
self.text_fmax
整数として受け入れられませんでした。したがって、この特定のフィールドは、最初に空であるかどうかがチェックされ、次に無視されます。そうでない場合、値は 0 から 180 までの整数でなければなりません。
def call_back(self):
if len(self.text_n.get()) == 0:
tkMessageBox.showinfo("Mandatory Information", "Please input an integer value for Number of Tessellations Cells")
elif len(self.text_id.get()) == 0:
tkMessageBox.showinfo("Mandatory Information", "Please input an integer value for Tessellation Identifier")
elif len(domain_container) == 0:
tkMessageBox.showinfo("Mandatory Information", "Please input Domain")
elif len(self.text_fmax.get()) != 0:
a = int(self.text_fmax.get())
if a < 0 or a > 180:
tkMessageBox.showinfo("Incorrect Value", "Face Flatness should be less than 180")
elif len(filename4) == 0:
tkMessageBox.showinfo("Mandatory Information", "Please input Output File Name")
else:
self.execute_neper_code()
elif len(filename4) == 0:
tkMessageBox.showinfo("Mandatory Information", "Please input Output File Name")
else:
self.execute_neper_code()