From bfd8f21cb8b110dbd7853d40de9b188f76bc250f Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 11 Feb 2018 20:50:12 +0100 Subject: [PATCH] recherche scroll --- cave.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/cave.py b/cave.py index 9ceb891..c5df0ad 100644 --- a/cave.py +++ b/cave.py @@ -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)