def __init__(self, parent=None): Frame.__init__(self, borderwidth=2) self.parent = parent mbuttonFile = Menubutton(self, text="Fichier") mbuttonPlus = Menubutton(self, text="Plus") mbuttonQuit = Menubutton(self, text="Quitter") mbuttonFile.pack(side="left") mbuttonPlus.pack(side="left") mbuttonQuit.pack(side="left") menuFile = Menu(mbuttonFile) menuFile.add_command(label="Enregistrer Default", command=self.defaultSave) menuFile.add_command(label="Enregistrer", command=self.save) menuFile.add_command(label="Charger Default", command=self.defaultLoad) menuFile.add_command(label="Charger Choix", command=self.load) menuPlus = Menu(mbuttonPlus) menuPlus.add_command(label="Infos", command=self.showInfos) menuQuit = Menu(mbuttonQuit) menuQuit.add_command(label="Quitter", command=parent.quit) menuQuit.add_command(label="Quitter avec confirmation", command=self.confirmQuit) mbuttonFile.configure(menu=menuFile) mbuttonPlus.configure(menu=menuPlus) mbuttonQuit.configure(menu=menuQuit)
def displaySectionForPrincipal(self, subject): self.course = subject rows = 24 columns = 3 for row in range(rows): for column in range(columns): empty = Label(self) empty.grid(row=row, column=column, padx=1, pady=1, sticky="nsew") label = Label(self, text=subject) label.grid(row=0, column=0, columnspan=3, padx=1, pady=1, sticky="nsew") self.sections = courseSections[subject].keys() self.noSection = IntVar() mb = Menubutton(self, text="Change Section") mb.menu = Menu(mb) mb["menu"] = mb.menu mb.menu.add_radiobutton(label=self.sections[0], value=0, variable=self.noSection, command=self.displaySection) mb.menu.add_radiobutton(label=self.sections[1], value=1, variable=self.noSection, command=self.displaySection) mb.grid(row=2, column=0, columnspan=2, padx=1, pady=1, sticky="nsew") def viewSection(): self.displaySectionForPrincipal(subject.get()) subject = StringVar() subMb = Menubutton(self, text="Change Subject") subMb.menu=Menu(subMb) subMb["menu"] = subMb.menu for course, sections in courseSections.items(): subMb.menu.add_radiobutton(label=course, value=course, variable=subject, command=viewSection) subMb.grid(row=2, column=2, padx=1, pady=1, sticky="nsew") self.displaySection()
def addPrincipalOptions(self): identity = ["Principal"] def viewSchedule(): identity.append("Schedule") identity.append(studentID.get()) self.display(*identity) def viewSection(): identity.append("Section") print(subject.get()) identity.append(subject.get()) self.display(*identity) schMb = Menubutton(self, text="View Schedules") schMb.menu = Menu(schMb) schMb["menu"] = schMb.menu studentID = IntVar() for n, student in studentSchedules.items(): schMb.menu.add_radiobutton(label=student["name"], value=int(n), variable=studentID, command=viewSchedule) schMb.grid(row=1, column=0, padx=1, pady=1, sticky="nsew") secMb = Menubutton(self, text="View Course Sections") secMb.menu = Menu(secMb) secMb["menu"] = secMb.menu subject = StringVar() for course, sections in courseSections.items(): secMb.menu.add_radiobutton(label=course, value=course, variable=subject, command=viewSection) secMb.grid(row=1, column=1, columnspan=2, padx=1, pady=1, sticky="nsew")
def displayScheduleForPrincipal(self, i): rows = 21 columns = 6 for row in range(rows): for column in range(columns): empty = Label(self) empty.grid(row=row, column=column, padx=1, pady=1, sticky="nsew") identity = Label(self, text=i) identity.grid(row=0, column=0, padx=1, pady=1, sticky="nsew") name = Label(self, text=studentSchedules[str(i)]["name"]) #to be modified name.grid(row=0, column=1, columnspan=5, padx=1, pady=1, sticky="nsew") def changeStudent(): #name = Label(self, text=studentSchedules[studentID.get()]["name"])#to be modified #name.grid(row=0, column=1, columnspan=5, padx=1, pady=1, sticky="nsew") bigEmpty = Label(self, background="black") bigEmpty.grid(row=2, column=1, rowspan=20, columnspan=5) for row in range(rows): for column in range(columns): if row > 1 and column > 0: empty = Label(self) empty.grid(row=row, column=column, padx=1, pady=1, sticky="nsew") self.displayCourses(studentID.get()) schMb = Menubutton(self, text="View Schedules") schMb.menu = Menu(schMb) schMb["menu"] = schMb.menu studentID = IntVar() for n, student in studentSchedules.items(): schMb.menu.add_radiobutton(label=student["name"], value=int(n), variable=studentID, command=changeStudent) schMb.grid(row=1, column=0, padx=1, pady=1, sticky="nsew") self.displayTimes() self.displayCourses(i)
def toc_menu(self, text): "Create table of contents as drop-down menu." toc = Menubutton(self, text='TOC') drop = Menu(toc, tearoff=False) for lbl, dex in text.parser.toc: drop.add_command(label=lbl, command=lambda dex=dex:text.yview(dex)) toc['menu'] = drop return toc
def AppendMenu(mbar, text, menu_list): button = Menubutton(mbar, text = text) button.pack(side = LEFT) menu = UpdatedMenu(button, menu_list) button.menu = menu button['menu'] = menu.menu return menu
def __init__(self, parent=None): Frame.__init__(self, borderwidth=2) button_file = Menubutton(self, text="File") menu_file = Menu(button_file) menu_file.add_command(label="New", command=parent.new) menu_file.add_command(label="Save", command=parent.save) menu_file.add_command(label="Exit", command=parent.exit) button_file.configure(menu=menu_file) button_file.pack()
def __init__(self, parent=None): Frame.__init__(self, borderwidth=2) mbuttonFile = Menubutton(self, text="Fichier") mbuttonFile.pack(side="left") menuFile = Menu(mbuttonFile) menuFile.add_command(label="Sauvegarder", command=parent.save) menuFile.add_command(label="Charger", command=parent.load) menuFile.add_command(label="Quitter", command=parent.quitter) mbuttonFile.configure(menu=menuFile) mbuttonFileBis = Menubutton(self, text="?") menuFileBis = Menu(mbuttonFileBis) menuFileBis.add_command(label="A propos", command=parent.about) mbuttonFileBis.configure(menu=menuFileBis) mbuttonFileBis.pack(side="left")
def __init__(self, parent): Frame.__init__(self, borderwidth=2) self.parent = parent # File Button Menu button_file = Menubutton(self, text="Fichier") menu_file = Menu(button_file) menu_file.add_command(label="Nouveau", command=self.parent.new) menu_file.add_command(label="Ouvrir", command=self.parent.open) menu_file.add_command(label="Sauvegarder", command=self.parent.save) menu_file.add_command(label="Quitter", command=self.parent.exit) button_file.configure(menu=menu_file) button_file.pack(side=LEFT, fill="x") # Help Button Menu button_file = Menubutton(self, text="Aide") menu_help = Menu(button_file) menu_help.add_command(label="A propos de nous", command=self.parent.help) button_file.configure(menu=menu_help) button_file.pack(side=LEFT)
def __init__(self, parent=None): Frame.__init__(self, bg='green', borderwidth=2) file_button = Menubutton(self, text="File") file_button.pack(side="left") file_menu = Menu(file_button) file_button.configure(menu=file_menu) file_menu.add_command(label='Save', underline=0, command=parent.file_save) # file_menu.add_command(label='Quit', underline=0, # command=parent.destroy) file_menu.add_command(label='Quit', underline=0, command=parent.file_quit) edit_button = Menubutton(self, text="Edit") edit_button.pack(side="left") edit_menu = Menu(edit_button) edit_button.configure(menu=edit_menu) edit_menu.add_command(label='Hide', underline=0, command=parent.delete_circle) edit_menu.add_command(label='Show', underline=0, command=parent.create_circle) help_button = Menubutton(self, text="Help") help_button.pack(side="right") help_menu = Menu(help_button) help_button.configure(menu=help_menu) help_menu.add_command(label='About Us', underline=0, command=parent.help_us) help_menu.add_command(label='About TkInter', underline=0, command=parent.help_tkinter)
def __init__(self, master=None): Frame.__init__(self, borderwidth=2) self.master = master button_file = Menubutton(self, text="Fichier", bg="white") button_file.pack(side="left") menu_file = Menu(button_file) menu_file.add_command(label='Effacer', underline=0, command=self.master.delete_circle) menu_file.add_command(label='Afficher', underline=0, command=self.master.create_circle) menu_file.add_command(label='Terminer', underline=0, command=self.master.quit) button_file.configure(menu=menu_file)
def AppendMenu(mbar, text, menu_list, underline): theme = app.uimanager.currentColorTheme # button = TMenubutton(mbar, text = text, underline=underline, style='RootMenuButton') button = Menubutton(mbar, text=text, underline=underline) button['background'] = theme.bg button['foreground'] = theme.foreground button['activebackground'] = theme.menuselectbackground button['activeforeground'] = theme.selectforeground button['relief'] = 'flat' button['highlightbackground'] = theme.menuselectbackground button['highlightcolor'] = theme.menuselectforeground button['highlightthickness'] = 0 button['bd'] = 0 button.pack(side=LEFT, padx=2, pady=0) menu = UpdatedMenu(button, menu_list) button.menu = menu button['menu'] = menu.menu return menu
def displayForTeacher(self, course): self.course = course rows = 24 columns = 3 for row in range(rows): for column in range(columns): empty = Label(self) empty.grid(row=row, column=column, padx=1, pady=1, sticky="nsew") label = Label(self, text=course) label.grid(row=0, column=0, columnspan=3, padx=1, pady=1, sticky="nsew") self.sections = courseSections[course].keys() self.noSection = IntVar() mb = Menubutton(self, text="Change Section") mb.menu = Menu(mb) mb["menu"] = mb.menu mb.menu.add_radiobutton(label=self.sections[0], value=0, variable=self.noSection, command=self.displaySection) mb.menu.add_radiobutton(label=self.sections[1], value=1, variable=self.noSection, command=self.displaySection) mb.grid(row=2, column=0, columnspan=3, padx=1, pady=1, sticky="nsew") self.displaySection()
def createWidgets(self): ''' #==================================================# :TOPBAR: #==================================================# ''' self.fileButton = Menubutton(self, text='File', relief='flat') self.fileButton.grid(row=0, column=0) self.fileButton.menu = Menu(self.fileButton, tearoff=0) self.fileButton["menu"] = self.fileButton.menu self.fileButton.menu.add_command(label="New", command=self.NewFile) self.fileButton.menu.add_command(label="Exit", command=self.quit) self.eButton = Menubutton(self, text="Enrollment", relief='flat') self.eButton.grid(row=0, column=1) self.eButton.menu = Menu(self.eButton, tearoff=0) self.eButton["menu"] = self.eButton.menu self.eButton.menu.add_command(label="Add Enrollment", command=self.add_Enroll) self.statButton = Menubutton(self, text="Statistics", relief='flat') self.statButton.grid(row=0, column=2) self.statButton.menu = Menu(self.statButton, tearoff=0) self.statButton["menu"] = self.statButton.menu self.discMenu = Menu(tearoff=0) self.discMenu.add_command(label="Sort by name", command=self.StudentEnrollA) self.discMenu.add_command(label="Sort by grade", command=self.StudentEnrollB) self.statButton.menu.add_cascade( label="Students Enrolled at disicpline", menu=self.discMenu) self.statButton.menu.add_command(label="Failing Students", command=self.FailingStudents) self.statButton.menu.add_command(label="Best Students", command=self.BestStudents) self.statButton.menu.add_command(label="Discipline Averages", command=self.DisciplineH) self.searchButton = Menubutton(self, text="Search", relief='flat') self.searchButton.grid(row=0, column=3) self.searchButton.menu = Menu(self.searchButton, tearoff=0) self.searchButton["menu"] = self.searchButton.menu self.searchButton.menu.add_command(label="Search", command=self.SearchALL) self.editButton = Menubutton(self, text="Edit", relief='flat') self.editButton.grid(row=0, column=4) self.editButton.menu = Menu(self.editButton, tearoff=0) self.editButton["menu"] = self.editButton.menu self.editButton.menu.add_command(label="Undo", command=self.undo) self.editButton.menu.add_command(label="Redo", command=self.redo) self.root.bind('<Control-z>', self.undo) self.root.bind('<Control-y>', self.redo) ''' #===================================================# :Student: #===================================================# ''' self.sbar = Label(self, text='Student list', fg='white', bg='#3B9C9C', width=49) self.sbar.grid(row=1, column=0, columnspan=16) self.sList = Listbox(self, exportselection=0) for index in self._studentControl.getCurentRepo().getStudents(): self.sList.insert(END, index) self.sList.grid(row=2, column=0, columnspan=16) self.sList.config(width=57, height=40) self.sMenu = Menu(self, tearoff=0) self.sMenu.add_command(label="Add Student", command=self.add_Student) self.sMenu.add_command(label="Remove Student", command=self.remove_Student) self.sMenu.add_command(label='Update Student ID', command=self.update_StudentID) self.sMenu.add_command(label='Update Student name', command=self.update_StudentName) self.sMenu.add_command(label='Refresh', command=self.Srefresh) self.sList.bind("<Button-3>", self.sPopup) ''' #===================================================# :Discipline: #===================================================# ''' self.dbar = Label(self, text='Discipline list', fg='white', bg='#3B9C9C', width=49) self.dbar.grid(row=1, column=16, columnspan=16) self.dList = Listbox(self, exportselection=0) for index in self._disciplineControl.getCurentRepo().getDisciplines(): self.dList.insert(END, index) self.dList.grid(row=2, column=16, columnspan=16) self.dList.config(width=57, height=40) self.dMenu = Menu(self, tearoff=0) self.dMenu.add_command(label="Add Discipline", command=self.add_Discipline) self.dMenu.add_command(label="Remove Discipline", command=self.remove_Discipline) self.dMenu.add_command(label='Update Discipline ID', command=self.update_DisciplineID) self.dMenu.add_command(label='Update Discipline name', command=self.update_DisciplineName) self.dMenu.add_command(label='Refresh', command=self.Drefresh) self.dList.bind("<Button-3>", self.dPopup) ''' #===================================================# :Enroll: #===================================================# ''' self.ebar = Label(self, text='Enroll list', fg='white', bg='#3B9C9C', width=49) self.ebar.grid(row=1, column=32, columnspan=16) self.eList = Listbox(self, exportselection=0) for index in self._enrolControl.getCurentRepo().getEnroll(): self.eList.insert(END, '\n' + str(index)) self.eList.grid(row=2, column=32, columnspan=16) self.eList.config(width=57, height=40) self.eMenu = Menu(self, tearoff=0) self.eMenu.add_command(label="Remove Enrollment", command=self.remove_Enroll) self.eMenu.add_command(label="Grade Student", command=self.add_EnrollGrade) self.eMenu.add_command(label='Refresh', command=self.Erefresh) self.eList.bind("<Button-3>", self.ePopup) ''' #===================================================# :Grade: #===================================================# ''' self.gbar = Label(self, text='Grade list', fg='white', bg='#3B9C9C', width=49) self.gbar.grid(row=1, column=48, columnspan=16) self.gList = Listbox(self, exportselection=0) for index in self._gradeControl.getCurentRepo().getGrades(): self.gList.insert(END, '\n' + str(index)) self.gList.grid(row=2, column=48, columnspan=16) self.gList.config(width=57, height=40) self.gMenu = Menu(self, tearoff=0) self.gMenu.add_command(label="Grade Student", command=self.add_Grade) self.gMenu.add_command(label='Refresh', command=self.Grefresh) self.gList.bind("<Button-3>", self.gPopup)
def initUI(self): self.parent.title("Booru") self.pack(fill=Y, expand=0, side=LEFT) myicon = ImageTk.PhotoImage(file="sbooru.ico") self.current_booru_var = StringVar() self.mb = Menubutton(self, textvariable=self.current_booru_var, relief=RAISED, image=myicon, compound=LEFT) self.mb.image = myicon self.mb.pack(side=TOP) self.mb.menu = Menu(self.mb, tearoff=0) self.mb["menu"] = self.mb.menu self.current_booru_var.set("Safebooru") def change_booru(booru): self.current_booru = booru if self.current_booru == 0: self.current_booru_var.set("Danbooru") if self.current_booru == 1: self.current_booru_var.set("Safebooru") self.mb.menu.add_command(label="Danbooru", command=lambda: change_booru(0)) self.mb.menu.add_command(label="Safebooru", command=lambda: change_booru(1)) self.mb.pack() image = Image.open( get_image_from_internet_binary( u"%s%s" % (main_url, self.posts[0][u"preview_file_url"]))) photo = ImageTk.PhotoImage(image) self.label = Label(self, image=photo) self.label.image = photo self.label.pack(fill=Y, expand=0, side=TOP) self.lb = Listbox(self) for i in self.posts: self.lb.insert(END, i["id"]) self.lb.bind("<<ListboxSelect>>", self.onSelect) self.lb.pack(pady=15, fill=Y, expand=0, side=LEFT) self.description = Labelframe(self, text="Description", height=350, width=350) self.description.pack(pady=15, expand=0) #artist self.artist_v = StringVar() self.artist = Label(self.description, textvariable=self.artist_v, justify=LEFT, wraplength=350, anchor=W) self.artist.pack() #md5 self.md5_v = StringVar() self.md5 = Label(self.description, textvariable=self.md5_v, justify=LEFT, wraplength=350, anchor=W) self.md5.pack() #source self.source_v = StringVar() self.source = Label(self.description, textvariable=self.source_v, justify=LEFT, wraplength=350, anchor=W) self.source.pack() #wxh self.wxh_v = StringVar() self.wxh = Label(self.description, textvariable=self.wxh_v, justify=LEFT, wraplength=350, anchor=W) self.wxh.pack() #tags (for now all) self.tags_v = StringVar() self.tags = Label(self.description, textvariable=self.tags_v, justify=LEFT, wraplength=350, anchor=W) self.tags.pack() #uploader self.uploader_v = StringVar() self.uploader = Label(self.description, textvariable=self.uploader_v, justify=LEFT, wraplength=350, anchor=W) self.uploader.pack() idx = (0, 0) try: self.artist_v.set(u"Artist:\t%s" % self.posts[idx[0]][u"tag_string_artist"]) except KeyError: self.artist_v.set(u"Artist:\t") try: self.md5_v.set(u"MD5:\t%s" % self.posts[idx[0]][u"md5"]) except KeyError: self.md5_v.set(u"MD5:\t") try: self.source_v.set(u"Source:\t%s" % self.posts[idx[0]][u"source"]) except KeyError: self.source_v.set(u"Source:\t") try: self.wxh_v.set(u"Size:\t%sx%s" % (self.posts[idx[0]][u"image_width"], self.posts[idx[0]][u"image_height"])) except KeyError: self.wxh_v.set(u"Size:\t") try: self.tags_v.set(u"Tags:\t%s" % self.posts[idx[0]][u"tag_string"]) except KeyError: self.tags_v.set(u"Tags:\t") try: self.uploader_v.set(u"Uploader:\t%s" % self.posts[idx[0]][u"uploader_name"]) except KeyError: self.uploader_v.set(u"Uploader:\t") self.button_frame = Frame(self.description) self.button_frame.pack(fill=Y, expand=0, side=LEFT) def download_image_current(): def download(): urllib.urlretrieve( "%s%s" % (main_url, self.current_image[u"file_url"]), "%s_%s.%s" % (self.current_image[u"id"], self.current_image[u"md5"], self.current_image[u"file_ext"])) t1 = Thread(target=download, args=()) t1.start() self.download_button = Button(self.button_frame, text="Download", command=download_image_current) self.download_button.pack(side=LEFT) def bigger_preview(): image = Image.open( get_image_from_internet_binary( u"%s%s" % (main_url, self.current_image[u"file_url"]))) photo = ImageTk.PhotoImage(image) self.bigpreview = Toplevel(self) labelu = Label(self.bigpreview, image=photo) labelu.image = photo labelu.pack(fill=Y, expand=0, side=LEFT) self.preview_button = Button(self.button_frame, text="Preview", command=bigger_preview) self.preview_button.pack(side=RIGHT) def onRefresh(): def method(): query_args["page"] = self.current_page.get() self.posts = get_posts("posts.json", query_args) self.lb.delete(0, END) for i in self.posts: self.lb.insert(END, i["id"]) t1 = Thread(target=method, args=()) t1.start() self.refresh = Button(self.button_frame, text="Refresh posts", command=onRefresh) self.refresh.pack(side=LEFT) page_control = Frame(self) page_control.pack(pady=15, side=BOTTOM) self.current_page = IntVar() self.current_page.set(1) def forward_f(): self.current_page.set(self.current_page.get() + 1) onRefresh() forward = Button(page_control, text=">>", command=forward_f) forward.pack(side=RIGHT) def backward_f(): self.current_page.set((self.current_page.get() - 1) if ( self.current_page.get() - 1 > 0) else self.current_page.get()) onRefresh() backward = Button(page_control, text="<<", command=backward_f) backward.pack(side=LEFT) curpaglabl = Label(page_control, textvariable=self.current_page, background="orange") curpaglabl.pack(pady=15, side=BOTTOM)
def __init__(self, root): self.root = root # Radio action buttons self.action = None self.sgmap_single_btn, self.krn_lib_btn, self.multi_map_btn = None, None, None self.file_log_var = StringVar() self.csv_file_var = StringVar() self.krn_folder_var = StringVar() self.output_folder_var = StringVar() self.sgmap_folder_var = StringVar() self.krn_ent_var = StringVar() self.krn_var, self.hem_var = IntVar(), IntVar() self.img, self.cdiag = None, None self.lat_lbl, self.lat_entry = None, None self.k_lbl, self.k_entry = None, None self.zen_lbl, self.zen_entry = None, None self.azi_lbl, self.azi_entry = None, None self.krn_lvl, self.krn_entry, self.krn_btn = None, None, None self.txt_redir, self.prg_log = None, None self.map_btn, self.gen_krn_btn = None, None # Sets window title, size, and icon on screen. self.root.title("Skyglow Estimation Toolbox (SET)") self.root.geometry('%dx%d+%d+%d' % (constants.SW * 0.75, constants.SH * 0.75, 25, 25)) self.root.iconbitmap(os.path.join(os.getcwd(), constants.ICO)) self.root.resizable(False, False) self.root.update_idletasks() # Creates three paned windows for the main screen. base = PanedWindow() base.pack(fill=BOTH, expand=1) sub1 = PanedWindow(base, orient=VERTICAL, height=self.root.winfo_height() * 3 / 4) base.add(sub1) sub2 = PanedWindow(sub1, orient=HORIZONTAL, height=self.root.winfo_height() / 5) sub1.add(sub2) # Creates frame for holding inputs. self.input_frame = Frame(sub2) sub2.add(self.input_frame) # Creates frame for bottom half of main screen. self.img_frame = Frame(sub1, bd=2, bg='white', relief="sunken") sub1.add(self.img_frame) # Creates canvas for displaying images. self.img_canvas = Canvas(self.img_frame, bd=2, relief="groove", width=constants.SW * 0.6, height=self.root.winfo_height() * 3 / 4 * 0.9) self.img_canvas.place(relx=.5, rely=.5, anchor=CENTER) # Creates help button for link to documentation, instructions, and about. self.help_btn = Menubutton(self.input_frame, text="Help", relief="raised", bd=2, width=8, pady=1) #self.help_btn.place(relx=1, rely=0, anchor=NE) self.help_btn.grid(column=4, columnspan=1, row=0) self.help_btn_menu = Menu(self.help_btn, tearoff=0) doc = 'https://github.com/NASA-DEVELOP' self.help_btn_menu.add_command(label="Documentation", command=lambda: self.open_url(doc)) self.help_btn_menu.add_command(label="Instructions", command=self.instructions) self.help_btn_menu.add_separator() self.help_btn_menu.add_command(label="About", command=self.about) self.help_btn["menu"] = self.help_btn_menu
def createInterface(self): # Handle to the toplevels interior interior = self.interior() menuBar = self.menuBar self.menuBar.destroy() # Create a frame to hold all stuff mainFrame = Frame(interior) self.listZone = Pmw.Group(mainFrame, tag_pyclass=None) self.listZone.pack(expand=0, fill=Tkinter.X, padx=3, pady=3) listFrame = self.listZone.interior() self.lightEntry = self.createcomponent( 'Lights List', (), None, Pmw.ComboBox, (listFrame, ), label_text='Light :', labelpos=Tkinter.W, entry_width=25, selectioncommand=self.selectLight, scrolledlist_items=self.lightList) self.lightEntry.pack(side=Tkinter.LEFT) self.renameButton = self.createcomponent('Rename Light', (), None, Button, (listFrame, ), text=' Rename ', command=self.renameLight) self.renameButton.pack(side=Tkinter.LEFT) self.addLighZone = Pmw.Group(listFrame, tag_pyclass=None) self.addLighZone.pack(side=Tkinter.LEFT) insideFrame = self.addLighZone.interior() self.lightsButton = Menubutton(insideFrame, text='Add light', borderwidth=3, activebackground='#909090') lightsMenu = Menu(self.lightsButton) lightsMenu.add_command(label='Add Ambient Light', command=self.addAmbient) lightsMenu.add_command(label='Add Directional Light', command=self.addDirectional) lightsMenu.add_command(label='Add Point Light', command=self.addPoint) lightsMenu.add_command(label='Add Spotlight', command=self.addSpot) self.lightsButton.pack(expand=0) self.lightsButton['menu'] = lightsMenu self.deleteButton = self.createcomponent('delete Light', (), None, Button, (listFrame, ), text=' Delete ', command=self.deleteLight) self.deleteButton.pack(side=Tkinter.LEFT) self.lightColor = seColorEntry(mainFrame, text='Light Color', value=self.lightColor) self.lightColor['command'] = self.setLightingColorVec self.lightColor['resetValue'] = [0.3 * 255, 0.3 * 255, 0.3 * 255, 0] self.lightColor.pack(fill=Tkinter.X, expand=0) self.bind(self.lightColor, 'Set light color') # Notebook pages for light specific controls self.lightNotebook = Pmw.NoteBook(mainFrame, tabpos=None, borderwidth=0) ambientPage = self.lightNotebook.add('Ambient') directionalPage = self.lightNotebook.add('Directional') pointPage = self.lightNotebook.add('Point') spotPage = self.lightNotebook.add('Spot') # Put this here so it isn't called right away self.lightNotebook['raisecommand'] = self.updateLightInfo # Directional light controls self.dSpecularColor = seColorEntry(directionalPage, text='Specular Color') self.dSpecularColor['command'] = self.setSpecularColor self.dSpecularColor.pack(fill=Tkinter.X, expand=0) self.bind(self.dSpecularColor, 'Set directional light specular color') self.dPosition = Vector3Entry(directionalPage, text='Position') self.dPosition['command'] = self.setPosition self.dPosition['resetValue'] = [0, 0, 0, 0] self.dPosition.pack(fill=Tkinter.X, expand=0) self.bind(self.dPosition, 'Set directional light position') self.dOrientation = Vector3Entry(directionalPage, text='Orientation') self.dOrientation['command'] = self.setOrientation self.dOrientation['resetValue'] = [0, 0, 0, 0] self.dOrientation.pack(fill=Tkinter.X, expand=0) self.bind(self.dOrientation, 'Set directional light orientation') # Point light controls self.pSpecularColor = seColorEntry(pointPage, text='Specular Color') self.pSpecularColor['command'] = self.setSpecularColor self.pSpecularColor.pack(fill=Tkinter.X, expand=0) self.bind(self.pSpecularColor, 'Set point light specular color') self.pPosition = Vector3Entry(pointPage, text='Position') self.pPosition['command'] = self.setPosition self.pPosition['resetValue'] = [0, 0, 0, 0] self.pPosition.pack(fill=Tkinter.X, expand=0) self.bind(self.pPosition, 'Set point light position') self.pConstantAttenuation = Slider(pointPage, text='Constant Attenuation', max=1.0, resolution=0.01, value=1.0) self.pConstantAttenuation['command'] = self.setConstantAttenuation self.pConstantAttenuation.pack(fill=Tkinter.X, expand=0) self.bind(self.pConstantAttenuation, 'Set point light constant attenuation') self.pLinearAttenuation = Slider(pointPage, text='Linear Attenuation', max=1.0, resolution=0.01, value=0.0) self.pLinearAttenuation['command'] = self.setLinearAttenuation self.pLinearAttenuation.pack(fill=Tkinter.X, expand=0) self.bind(self.pLinearAttenuation, 'Set point light linear attenuation') self.pQuadraticAttenuation = Slider(pointPage, text='Quadratic Attenuation', max=1.0, resolution=0.01, value=0.0) self.pQuadraticAttenuation['command'] = self.setQuadraticAttenuation self.pQuadraticAttenuation.pack(fill=Tkinter.X, expand=0) self.bind(self.pQuadraticAttenuation, 'Set point light quadratic attenuation') # Spot light controls self.sSpecularColor = seColorEntry(spotPage, text='Specular Color') self.sSpecularColor['command'] = self.setSpecularColor self.sSpecularColor.pack(fill=Tkinter.X, expand=0) self.bind(self.sSpecularColor, 'Set spot light specular color') self.sConstantAttenuation = Slider(spotPage, text='Constant Attenuation', max=1.0, resolution=0.01, value=1.0) self.sConstantAttenuation['command'] = self.setConstantAttenuation self.sConstantAttenuation.pack(fill=Tkinter.X, expand=0) self.bind(self.sConstantAttenuation, 'Set spot light constant attenuation') self.sLinearAttenuation = Slider(spotPage, text='Linear Attenuation', max=1.0, resolution=0.01, value=0.0) self.sLinearAttenuation['command'] = self.setLinearAttenuation self.sLinearAttenuation.pack(fill=Tkinter.X, expand=0) self.bind(self.sLinearAttenuation, 'Set spot light linear attenuation') self.sQuadraticAttenuation = Slider(spotPage, text='Quadratic Attenuation', max=1.0, resolution=0.01, value=0.0) self.sQuadraticAttenuation['command'] = self.setQuadraticAttenuation self.sQuadraticAttenuation.pack(fill=Tkinter.X, expand=0) self.bind(self.sQuadraticAttenuation, 'Set spot light quadratic attenuation') self.sExponent = Slider(spotPage, text='Exponent', max=1.0, resolution=0.01, value=0.0) self.sExponent['command'] = self.setExponent self.sExponent.pack(fill=Tkinter.X, expand=0) self.bind(self.sExponent, 'Set spot light exponent') # MRM: Add frustum controls self.lightNotebook.setnaturalsize() self.lightNotebook.pack(expand=1, fill=Tkinter.BOTH) mainFrame.pack(expand=1, fill=Tkinter.BOTH)