1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#!/usr/local/bin/python
# -*- coding:utf-8 -*-
from Tkinter import *
class Application( Tk ):
def __init__(self):
Tk.__init__(self)
self.title('PanedWindow - v.1')
self.geometry("600x400")
self.pwHoriz = PanedWindow( self )
self.pwHoriz.pack(fill=BOTH, expand=1)
pwVerti1 = PanedWindow(self.pwHoriz, orient=VERTICAL)
self.pwHoriz.add(pwVerti1)
pwVerti2 = PanedWindow(self.pwHoriz, orient=VERTICAL)
self.pwHoriz.add(pwVerti2)
self.cans = [None ] * 4
self.cans[0] = self.cvert1top = Canvas(pwVerti1, bg="yellow", height = 200, width = 300)
self.cvert1top.pack(fill=BOTH, expand=YES)
self.cans[1] = self.cvert1bot = Canvas(pwVerti1, bg="blue", height = 200, width = 300)
self.cvert1bot.pack(fill=BOTH, expand=YES)
self.cans[2] = self.cvert2top = Canvas(pwVerti2, bg="red", height = 200, width = 300)
self.cvert2top.pack(fill=BOTH, expand=YES)
self.cans[3] = self.cvert2bot = Canvas(pwVerti2, bg="green", height = 200, width = 300)
self.cvert2bot.pack(fill=BOTH, expand=YES)
self.bind("<Configure>", self.resize)
self.mainloop()
def resize( self, event ) :
self.update_idletasks( )
width_can = self.winfo_width() // 2
height_can = self.winfo_height() // 2
for can in self.cans :
can.configure( height = height_can )
# Méthode pour bouger la barre de panel.
# départ du programme principal :
if __name__ == "__main__":
f = Application() |
Partager