finalisation scroolbar
This commit is contained in:
parent
bfd8f21cb8
commit
c9bbbab7e1
26
cave.py
26
cave.py
@ -52,7 +52,7 @@ class Etageres(object):
|
|||||||
for etagere in self.etageres:
|
for etagere in self.etageres:
|
||||||
if etagere.num_etagere == num_etagere:
|
if etagere.num_etagere == num_etagere:
|
||||||
self.etageres.remove(etagere)
|
self.etageres.remove(etagere)
|
||||||
self.nbetagere -= 1
|
|
||||||
return 0
|
return 0
|
||||||
return "pas d'étagere a ce numéros"
|
return "pas d'étagere a ce numéros"
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class Bouteille(object):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "{},{} \n".format(self.appelation, self.millesime)
|
return "{},{} ".format(self.appelation, self.millesime)
|
||||||
|
|
||||||
|
|
||||||
class EtageresUI(Tk):
|
class EtageresUI(Tk):
|
||||||
@ -141,12 +141,12 @@ class EtageresUI(Tk):
|
|||||||
self.etageresUI = []
|
self.etageresUI = []
|
||||||
self.mainframe=Frame(self)
|
self.mainframe=Frame(self)
|
||||||
vscrollbar = Scrollbar(self.mainframe, orient=VERTICAL)
|
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)
|
self.etagere_frame = Canvas(self.mainframe, yscrollcommand=vscrollbar.set,width=1000,height=1000)
|
||||||
|
|
||||||
for etagere in self.etageres:
|
for etagere in self.etageres:
|
||||||
newetagere=EtagereUI(etagere, self)
|
newetagere=EtagereUI(etagere, self)
|
||||||
self.etageresUI.append(newetagere)
|
self.etageresUI.append(newetagere)
|
||||||
self.etagere_frame.create_window(0, 0,window=newetagere)
|
self.etagere_frame.config(scrollregion=self.etagere_frame.bbox("all"))
|
||||||
|
|
||||||
vscrollbar.grid(column=2, row=1, sticky=N+S)
|
vscrollbar.grid(column=2, row=1, sticky=N+S)
|
||||||
vscrollbar.config(command=self.etagere_frame.yview)
|
vscrollbar.config(command=self.etagere_frame.yview)
|
||||||
@ -179,6 +179,7 @@ class EtageresUI(Tk):
|
|||||||
child_window.destroy()
|
child_window.destroy()
|
||||||
newetagere = self.etageres.add_etagere(int(largeur), int(hauteur))
|
newetagere = self.etageres.add_etagere(int(largeur), int(hauteur))
|
||||||
self.etageresUI.append(EtagereUI(newetagere, self))
|
self.etageresUI.append(EtagereUI(newetagere, self))
|
||||||
|
self.etagere_frame.config(scrollregion=self.etagere_frame.bbox("all"))
|
||||||
|
|
||||||
def click_remove_etagere(self):
|
def click_remove_etagere(self):
|
||||||
child_window = Toplevel(self)
|
child_window = Toplevel(self)
|
||||||
@ -192,7 +193,9 @@ class EtageresUI(Tk):
|
|||||||
for etagereUI in self.etageresUI:
|
for etagereUI in self.etageresUI:
|
||||||
if etagereUI.etagere.num_etagere == int(num):
|
if etagereUI.etagere.num_etagere == int(num):
|
||||||
print("find")
|
print("find")
|
||||||
etagereUI.destroy()
|
self.etagere_frame.delete(etagereUI.canvasID)
|
||||||
|
self.etageresUI.remove(etagereUI)
|
||||||
|
|
||||||
self.etageres.remove_etagere(int(num))
|
self.etageres.remove_etagere(int(num))
|
||||||
|
|
||||||
|
|
||||||
@ -202,7 +205,6 @@ class EtagereUI(LabelFrame):
|
|||||||
LabelFrame.__init__(self, etageresUI.etagere_frame, text=etagere)
|
LabelFrame.__init__(self, etageresUI.etagere_frame, text=etagere)
|
||||||
self.etagere = etagere
|
self.etagere = etagere
|
||||||
self.etageresUI = etageresUI
|
self.etageresUI = etageresUI
|
||||||
|
|
||||||
for hauteur in range(self.etagere.hauteur):
|
for hauteur in range(self.etagere.hauteur):
|
||||||
for largeur in range(self.etagere.largeur):
|
for largeur in range(self.etagere.largeur):
|
||||||
isset = False
|
isset = False
|
||||||
@ -213,7 +215,14 @@ class EtagereUI(LabelFrame):
|
|||||||
break
|
break
|
||||||
if not isset:
|
if not isset:
|
||||||
Cassier_videUI(largeur, hauteur, self)
|
Cassier_videUI(largeur, hauteur, self)
|
||||||
self.grid(row=self.etagere.num_etagere)
|
if(len(self.etageresUI.etageresUI)==0):
|
||||||
|
|
||||||
|
self.canvasID=etageresUI.etagere_frame.create_window(0, 0,window=self,anchor="nw",tag="ALL")
|
||||||
|
else:
|
||||||
|
bbox=self.etageresUI.etagere_frame.bbox("ALL")
|
||||||
|
print(bbox)
|
||||||
|
self.canvasID=etageresUI.etagere_frame.create_window(0,bbox[3]+20,anchor="nw",window=self,tag="ALL")
|
||||||
|
self.etageresUI.etagere_frame.update()
|
||||||
|
|
||||||
def click_remove_bouteille(self, bouteilleUI):
|
def click_remove_bouteille(self, bouteilleUI):
|
||||||
self.etagere.remove_bouteille(
|
self.etagere.remove_bouteille(
|
||||||
@ -223,6 +232,9 @@ class EtagereUI(LabelFrame):
|
|||||||
bouteilleUI.bouteille.pos_hauteur, self)
|
bouteilleUI.bouteille.pos_hauteur, self)
|
||||||
self["text"] = self.etagere
|
self["text"] = self.etagere
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def click_add_bouteille(self, cassiervide):
|
def click_add_bouteille(self, cassiervide):
|
||||||
|
|
||||||
child_window = Toplevel(self.etageresUI)
|
child_window = Toplevel(self.etageresUI)
|
||||||
|
Loading…
Reference in New Issue
Block a user