Kivyのツリービューには、どれだけ大きいかによって時間がかかります。別のスレッドで実行されているKivyポップアップ
ツリーが大きく、しばらく時間がかかる場合は、ポピュレート中にポップアップを表示して、プログラムがフリーズしていないことをユーザーが認識しているのを確認して、ツリーをポピュレートするロジックが終了したらこのポップアップを閉じます。ここで
は、私はこのトピックに関するいくつかの研究を通じて出ているものですが、ポップアップはまだツリーが移入終了するとだけ来るようだ:
def show(self, *args):
self.error_popup.open()
def populate_tree(self, model):
#Clock.schedule_once(self.error_popup.open())
popup_thread = threading.Thread(target=self.show())
popup_thread.start()
# order the dictionary for better user experience
ordered_data = collections.OrderedDict(sorted(model.items()))
# logic to populate tree
for county, value in ordered_data.items():
if county != "model_name":
# set initial county dropdowns in tree
county_label = self.treeview.add_node(TreeViewButton(text=str(county), on_press=self.edit_node))
i = 0 # keep count of rules
# add rules children to county
for rule_obj, rule_list in value.items():
for rule in rule_list:
i += 1
# set rule number in tree
rule_label = self.treeview.add_node(TreeViewButton(text='Rule ' + str(i), on_press=self.edit_node), county_label)
# add conditions children to rule
for condition in rule:
self.treeview.add_node(TreeViewButton(text=condition, on_press=self.edit_node), rule_label)
#Clock.schedule_once(self.error_popup.dismiss())
#somehow close popup_thread
私は場合それでkivy時計の試みを含め私が探しているものの正しい軌道上にありますが、現在のところ、ポップアップを開いてしまい、ツリーにデータを入力することはありません。私はGUIプログラミングとイベントのコールバックに新しいので、どんな助けも大歓迎です。
もっとコードが必要な場合は、私に教えてください。