add scrollbar change button

This commit is contained in:
vincent 2018-08-23 23:18:39 +02:00
parent 2d2209e640
commit c74fb7a6cc

14
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,Frame
from tkinter import Scrollbar,Label,LabelFrame,Entry,Button,OptionMenu,StringVar,Canvas,Toplevel,N,S,VERTICAL,Tk,Frame,HORIZONTAL,E,W
class Etageres(object):
def __init__(self):
@ -130,7 +130,7 @@ class Bouteille(object):
return data
def __repr__(self):
return "{},{} ".format(self.appelation, self.millesime)
return "{} \n {} ".format(self.appelation, self.millesime)
class EtageresUI(Tk):
@ -141,7 +141,8 @@ class EtageresUI(Tk):
self.etageresUI = []
self.mainframe=Frame(self)
vscrollbar = Scrollbar(self.mainframe, orient=VERTICAL)
self.etagere_frame = Canvas(self.mainframe, yscrollcommand=vscrollbar.set,width=1000,height=1000)
hscrollbar = Scrollbar(self.mainframe, orient=HORIZONTAL)
self.etagere_frame = Canvas(self.mainframe,xscrollcommand=hscrollbar.set, yscrollcommand=vscrollbar.set,width=1000,height=1000)
for etagere in self.etageres:
newetagere=EtagereUI(etagere, self)
@ -150,7 +151,8 @@ class EtageresUI(Tk):
vscrollbar.grid(column=2, row=1, sticky=N+S)
vscrollbar.config(command=self.etagere_frame.yview)
hscrollbar.grid(column=1, row=2, sticky=E+W)
hscrollbar.config(command=self.etagere_frame.xview)
framecontrol = LabelFrame(self.mainframe, text="command pannel")
framecontrol.grid(column=3, row=1)
Button(framecontrol, text="add etagere",
@ -270,7 +272,7 @@ class EtagereUI(LabelFrame):
class Cassier_videUI(Button):
def __init__(self, pos_largeur, pos_hauteur, etagereUI):
Button.__init__(self, etagereUI, text="cassier vide",
Button.__init__(self, etagereUI, text="cassier vide",justify="center",width=15,
command=lambda: self.etagereUI.click_add_bouteille(self))
self.pos_largeur = pos_largeur
self.pos_hauteur = pos_hauteur
@ -282,7 +284,7 @@ class BouteilleUI(Button):
def __init__(self, bouteille, etagereUI):
self.bouteille = bouteille
self.etagereUI = etagereUI
Button.__init__(self, etagereUI, text=self.bouteille,
Button.__init__(self, etagereUI, text=self.bouteille,justify="center",width=15,
command=lambda: self.etagereUI.click_remove_bouteille(self))
self["bg"] = self.etagereUI.etageresUI.etageres.couleur[self.bouteille.couleur]
self.grid(row=self.bouteille.pos_hauteur,