Added loader column
This commit is contained in:
@@ -15,15 +15,20 @@ def on_treeview_heading_click(column, tree):
|
|||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
root.title('Module explorer')
|
root.title('Module explorer')
|
||||||
root.geometry('640x480')
|
root.geometry('640x480')
|
||||||
tree = ttk.Treeview(root, columns=('module', 'path'))
|
tree = ttk.Treeview(root, columns=('module', 'path', 'loader'))
|
||||||
tree.heading('module', text='Module Name', anchor=tk.W)
|
tree.heading('module', text='Module Name', anchor=tk.W)
|
||||||
tree.heading('path', text='Path', anchor=tk.W)
|
tree.heading('path', text='Path', anchor=tk.W)
|
||||||
|
tree.heading('loader', text='Loader', anchor=tk.W)
|
||||||
for module in sys.modules:
|
for module in sys.modules:
|
||||||
if hasattr(sys.modules[module], '__spec__') and hasattr(sys.modules[module].__spec__, 'origin'):
|
if hasattr(sys.modules[module], '__spec__') and hasattr(sys.modules[module].__spec__, 'origin'):
|
||||||
origin = sys.modules[module].__spec__.origin
|
origin = sys.modules[module].__spec__.origin
|
||||||
else:
|
else:
|
||||||
origin = "None"
|
origin = "None"
|
||||||
iid = tree.insert('', tk.END, values=(module, origin))
|
if hasattr(sys.modules[module], '__loader__'):
|
||||||
|
loader = sys.modules[module].__loader__
|
||||||
|
else:
|
||||||
|
loader = "None"
|
||||||
|
iid = tree.insert('', tk.END, values=(module, origin, loader))
|
||||||
|
|
||||||
tree.grid(row=0, column=0, sticky='nsew')
|
tree.grid(row=0, column=0, sticky='nsew')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user