成果物
コード
#!/usr/bin/env python3 # coding: utf-8 import tkinter as tk import tkinter.ttk as ttk root = tk.Tk() root.title('Application') root.minsize(640, 480) root.columnconfigure(0, weight=1) root.rowconfigure(0, weight=1) tree = ttk.Treeview(root) tree.insert('', 0, 'item1', text='item1') tree.insert('', 'end', 'item2', text='item2', open=True) tree.insert('item2', 'end', text='item21') tree.insert('item2', 'end', text='item22') tree.insert('', 'end', text='item3') tree.grid(sticky="SNEW") tree.focus(tree.identify_row(0)) tree.focus_set() tree.selection_set(tree.identify_row(0)) root.mainloop()
実行結果
./tree.py
キーボードの上下で移動。左右で開閉。
問題
- 一番上のヘッダ行っぽいヤツが邪魔
対象環境
- Raspbierry pi 3 Model B+
- Raspbian stretch 9.0 2018-11-13 ※
- bash 4.4.12(1)-release ※
- Python 3.5.3
- tkinter 8.6
- SQLite 3.29.0 ※
- MeCab 0.996ユーザ辞書
$ uname -a Linux raspberrypi 4.19.42-v7+ #1218 SMP Tue May 14 00:48:17 BST 2019 armv7l GNU/Linux