Professional Documents
Culture Documents
= 0, count=0, addY=0): Frame.__init__(self, parent) self.roomNum = roomNum self.addY=addY self.count = count self.master.title("Storage room") self.master.geometry("500x300+10+10") Label(self.master, text="="*200).place(x = 0, y=52) self.pack(expand = YES, fill = BOTH) self.initUI() def initUI(self): TEXTS = ["create", "delete"] COMMAND= [self.createRoom, self.deleteRoom] for i in range(2): buttons = Button(self.master, text = TEXTS[i], command= COMMAND[i]) buttons.config(font = ('bold', 10)) buttons.place(x = 20+i*100, y = 1, width = 50, height = 50) def createRoom(self): self.roomNum +=100 self.count +=1 button =Button(self.master, text = 'storage%s' % self.count, relief=RIDG E) if (self.count) % 5 ==0: self.addY +=100 self.roomNum=100 button.place(x = -70+self.roomNum, y = 70+ self.addY, width =100, height =100)
def deleteRoom(self): pass class ThemeButton(Button): def __init__(self, parent, imagefile): Button.__init__(self, parent = None) self.pack() self.image = PhotoImage(file = imagefile) self.config(image = self.image, command = self.destroy)