in the middle of methods
This commit is contained in:
parent
8478c6f5f0
commit
b348eee285
15
JFSphoto.py
15
JFSphoto.py
@ -320,7 +320,7 @@ class Jfsphoto (object):
|
|||||||
else:
|
else:
|
||||||
self.kbtn.config(relief='sunken')
|
self.kbtn.config(relief='sunken')
|
||||||
self.do_3dprint()
|
self.do_3dprint()
|
||||||
|
|
||||||
win = tk.Toplevel()
|
win = tk.Toplevel()
|
||||||
self.center = tk.Frame(win, bg='gray2', width=800, height=400, padx=3, pady=3)
|
self.center = tk.Frame(win, bg='gray2', width=800, height=400, padx=3, pady=3)
|
||||||
self.center.grid_rowconfigure(0, weight=1)
|
self.center.grid_rowconfigure(0, weight=1)
|
||||||
@ -354,11 +354,6 @@ class Jfsphoto (object):
|
|||||||
self.kbtn = tk.Button(master=self.ctr_right,text="3 D Print",command=toggle,width=15,relief='raised')
|
self.kbtn = tk.Button(master=self.ctr_right,text="3 D Print",command=toggle,width=15,relief='raised')
|
||||||
self.kbtn.grid(row=17,column=0,sticky="w")
|
self.kbtn.grid(row=17,column=0,sticky="w")
|
||||||
|
|
||||||
#self.scrollbar = tk.Scrollbar(master=self.ctr_right)
|
|
||||||
#self.listbox.config(yscrollcommand =self.scrollbar.set)
|
|
||||||
#self.scrollbar.config(command = self.listbox.yview)
|
|
||||||
|
|
||||||
|
|
||||||
if self.calculate() :
|
if self.calculate() :
|
||||||
self.show_first_look()
|
self.show_first_look()
|
||||||
else:
|
else:
|
||||||
@ -416,10 +411,10 @@ class Jfsphoto (object):
|
|||||||
self.ok.set(1)
|
self.ok.set(1)
|
||||||
self.canvas.draw()
|
self.canvas.draw()
|
||||||
|
|
||||||
def kini(self):
|
# def kini(self):
|
||||||
self.load_kinetics("kini.dat")
|
# self.load_kinetics("kini.dat")
|
||||||
self.calculate()
|
# self.calculate()
|
||||||
self.show_first_look()
|
# self.show_first_look()
|
||||||
|
|
||||||
|
|
||||||
def do_get_range(self):
|
def do_get_range(self):
|
||||||
|
|||||||
32
test_tree1.py
Normal file
32
test_tree1.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import tkinter as tk
|
||||||
|
from tkinter import ttk
|
||||||
|
|
||||||
|
root = tk.Tk()
|
||||||
|
|
||||||
|
tree = ttk.Treeview(root)
|
||||||
|
tree.grid()
|
||||||
|
def cb(event):
|
||||||
|
print(event, tree.selection(), tree.focus())
|
||||||
|
|
||||||
|
tree.tag_bind('cb','<1>',cb)
|
||||||
|
tree.tag_bind('cb','<<TreeviewSelect>>',cb)
|
||||||
|
tree.tag_bind('cb', '<<TreeviewOpen>>', cb)
|
||||||
|
tree.tag_bind('cb', '<<TreeviewClose>>', cb)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tree.insert('', 'end', 'widgets', text='Widgets',tags=('cb'))
|
||||||
|
tree.insert('', 0, 'apps', text='Applications',tags=('cb'))
|
||||||
|
|
||||||
|
tree['columns'] = ('size', 'modified')
|
||||||
|
tree.column('size', width=50, anchor='center')
|
||||||
|
tree.heading('size', text='Size')
|
||||||
|
tree.heading('modified', text='Modified')
|
||||||
|
|
||||||
|
tree.set('widgets', 'size', '12KB')
|
||||||
|
tree.set('widgets', 'modified', 'Last week')
|
||||||
|
|
||||||
|
tree.insert('', 'end', text='Canvas', values=('25KB Today'),tags=('cb'))
|
||||||
|
tree.insert('apps', 'end', text='Browser', values=('115KB Yesterday'),tags=('cb'))
|
||||||
|
|
||||||
|
root.mainloop()
|
||||||
44
test_treeview.py
Normal file
44
test_treeview.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import tkinter as tk
|
||||||
|
from tkinter import ttk
|
||||||
|
|
||||||
|
class ButtonTree(ttk.Frame):
|
||||||
|
def __init__(self, parent, items):
|
||||||
|
ttk.Frame.__init__(self, parent)
|
||||||
|
self.parent = parent
|
||||||
|
self.items = items
|
||||||
|
self.tree = MyTree(self, items)
|
||||||
|
self.tree.grid(column=0, row=0, sticky=tk.N)
|
||||||
|
self.buttons = ttk.Frame(self, width=100)
|
||||||
|
self.buttons.grid(column=1, row=0, sticky=tk.N)
|
||||||
|
#print(self.tree.config())
|
||||||
|
|
||||||
|
def create_buttons(self):
|
||||||
|
self.update()
|
||||||
|
so_far = header_height = 16 + 2
|
||||||
|
ttk.Frame(self.buttons).place(in_=self.buttons, x=0, y=0, width=100, height=header_height)
|
||||||
|
|
||||||
|
for item_name, item in zip(self.tree.get_children(), self.items):
|
||||||
|
print(item_name, item,self.tree.bbox(item_name))
|
||||||
|
button = ttk.Button(self.buttons, text = "Do Something...")
|
||||||
|
h = self.tree.bbox(item_name)[-1]
|
||||||
|
button.place(in_=self.buttons, x=0, y=so_far, width=100, height=h)
|
||||||
|
so_far += h
|
||||||
|
self.buttons["height"] = len(self.items)*20 + header_height
|
||||||
|
|
||||||
|
class MyTree(ttk.Treeview):
|
||||||
|
def __init__(self, parent, items):
|
||||||
|
ttk.Treeview.__init__(self, parent, columns = ("A"), padding=1)
|
||||||
|
self.heading("A", text = "Some A")
|
||||||
|
self.parent = parent
|
||||||
|
self.items = items
|
||||||
|
for item in self.items:
|
||||||
|
self.insert(parent = "", index = "end", text = item, values = "hello")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
root = tk.Tk()
|
||||||
|
buttonTree = ButtonTree(root, list(range(10)))
|
||||||
|
buttonTree.pack()
|
||||||
|
#buttonTree.create_buttons()
|
||||||
|
root.mainloop()
|
||||||
15
tklib.py
Normal file
15
tklib.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import tkinter as tk
|
||||||
|
|
||||||
|
class App:
|
||||||
|
"""Define the application class."""
|
||||||
|
def __init__(self):
|
||||||
|
|
||||||
|
self.root = tk.Tk()
|
||||||
|
self.label = tk.Label(self.root, text='hello world!', font='Arial 24')
|
||||||
|
self.label.grid()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
"""Run the main loop."""
|
||||||
|
self.root.mainloop()
|
||||||
|
|
||||||
|
App().run()
|
||||||
Loading…
Reference in New Issue
Block a user