recherche scroll

This commit is contained in:
vincent 2018-02-11 20:50:12 +01:00
parent 9ffee40a54
commit bfd8f21cb8

19
cave.py
View File

@ -1,5 +1,5 @@
import json
from tkinter import Scrollbar,Label,LabelFrame,Entry,Button,OptionMenu,StringVar,Canvas,Toplevel,N,S,VERTICAL,Tk
from tkinter import Scrollbar,Label,LabelFrame,Entry,Button,OptionMenu,StringVar,Canvas,Toplevel,N,S,VERTICAL,Tk,Frame
class Etageres(object):
def __init__(self):
@ -139,16 +139,20 @@ class EtageresUI(Tk):
self.etageres = etageres
self.title(string="cave a vin")
self.etageresUI = []
self.mainframe=Frame(self)
vscrollbar = Scrollbar(self.mainframe, orient=VERTICAL)
self.etagere_frame = Canvas(self.mainframe,bg="white", yscrollcommand=vscrollbar.set,scrollregion =(0,0,300,300),width=1000,height=1000)
for etagere in self.etageres:
newetagere=EtagereUI(etagere, self)
self.etageresUI.append(newetagere)
self.etagere_frame.create_window(0, 0,window=newetagere)
vscrollbar = Scrollbar(self, orient=VERTICAL)
self.etagere_frame = Canvas(self, yscrollcommand=vscrollbar.set)
vscrollbar.grid(column=2, row=1, sticky=N+S)
vscrollbar.config(command=self.etagere_frame.yview)
for etagere in self.etageres:
self.etageresUI.append(EtagereUI(etagere, self))
framecontrol = LabelFrame(self.etagere_frame, text="command pannel")
framecontrol.grid(column=2, row=1)
framecontrol = LabelFrame(self.mainframe, text="command pannel")
framecontrol.grid(column=3, row=1)
Button(framecontrol, text="add etagere",
command=self.click_add_etagere).pack()
Button(framecontrol, text="remove etagere",
@ -156,6 +160,7 @@ class EtageresUI(Tk):
Button(framecontrol, text="save",
command=lambda: self.etageres.save_etageres("cave")).pack()
self.etagere_frame.grid(column=1, row=1)
self.mainframe.grid()
def click_add_etagere(self):
child_window = Toplevel(self)