def initUI(self): self.entries_found = [] self.parent.title("Search your command cards") self.style = Style() self.style.theme_use("default") self.pack() self.input_title = Label(self, text="Enter your command below") self.input_title.grid(row=0, columnspan=2) self.input_box = Entry(self, width=90) self.input_box.grid(row=1, column=0) self.input_box.focus() self.input_box.bind("<Key>", self.onUpdateSearch) self.search_btn = Button(self, text="Search", command=self.onSearch) self.search_btn.grid(row=1, column=1) self.output_box = Treeview(self, columns=("Example")) ysb = Scrollbar(self, orient='vertical', command=self.output_box.yview) xsb = Scrollbar(self, orient='horizontal', command=self.output_box.xview) self.output_box.configure(yscroll=ysb.set, xscroll=xsb.set) self.output_box.heading('Example', text='Example', anchor='w') self.output_box.column("#0", minwidth=0, width=0, stretch=NO) self.output_box.column("Example", minwidth=0, width=785) self.output_box.bind("<Button-1>", self.OnEntryClick) self.output_box.grid(row=3, columnspan=2) self.selected_box = Text(self, width=110, height=19) self.selected_box.grid(row=4, columnspan=2) self.gotoadd_btn = Button(self, text="Go to Add", command=self.onGoToAdd) self.gotoadd_btn.grid(row=5)
def initUI(self): # This should be different if running on Windows.... content = pyperclip.paste() print content self.entries_found = [] self.parent.title("Add a new command card") self.style = Style() self.style.theme_use("default") self.pack() self.new_title_label = Label(self, text="Title") self.new_title_label.grid(row=0, columnspan=2) self.new_title_entry = Entry(self, width=90) self.new_title_entry.grid(row=1, column=0) self.new_title_entry.focus() self.new_content_label = Label(self, text="Card") self.new_content_label.grid(row=2, columnspan=2) self.new_content_text = Text(self, width=110, height=34) self.new_content_text.insert(END, content) self.new_content_text.grid(row=3, columnspan=2) self.add_new_btn = Button(self, text="Add New Card", command=self.onAddNew) self.add_new_btn.grid(row=4)
def instructions(self): """Open instructions window.""" # Instantiates separate Toplevel instruction window. instr_window = Toplevel(self.root) instr_window.geometry('550x575+25+25') instr_window.title('Instructions') instr_window.wm_iconbitmap(constants.ICO) instr_window.resizable(False, False) # Creatse Scrollbar and Frame for containing other widgets. instr_scroll = Scrollbar(instr_window) instr_scroll.pack(fill=Y, side="right") instr_frame = Frame(instr_window, bg='white') instr_frame.pack(fill=BOTH, side="left") # Adds instruction text from constants and adds image of Cinzano's diagram. instr = Text(instr_frame, width=65, height=40, padx=10, pady=5, bd=0, wrap="word") instr.insert("end", constants.INSTR) cdiagram_file = Image.open("./static/cinzano_diagram.PNG") cdiagram_file = cdiagram_file.resize((500, 450), Image.ANTIALIAS) self.cdiag = ImageTk.PhotoImage(cdiagram_file) instr.image_create("end", image=self.cdiag) instr.tag_add("top", "1.0", "4.10") instr.tag_config("top", font='Times 12 bold') instr.tag_add("body", "5.0", "19.20") instr.tag_config("body", font='Times 12') instr.insert("end", constants.CDIAG) instr.pack() instr_scroll.config(command=instr.yview)
def create_bottom_frame(self): """ Initializes the bottom half of the window """ self.bottom_frame = Frame(self.container) self.bottom_frame.pack(side=BOTTOM, fill=X, expand=False) note_string = StringVar() note_string.set('Notes:') note_label = Label(self.bottom_frame, textvariable=note_string) note_label.grid(row=0, column=1) self.note_text = Text(self.bottom_frame, width=55, height=10) self.note_text.grid(row=1, column=1, padx=6) self.note_text.insert(END, self.__shape.get_notes()) button_frame = Frame(self.container) button_frame.pack(side=BOTTOM, fill=X, expand=False) accept_button = Button(button_frame, text='Save', width=9, command=self.save) accept_button.pack(side=LEFT, pady=5, padx=2) cancel_button = Button(button_frame, text='Clear Note', width=9, command=self.clear) cancel_button.pack(side=LEFT, pady=5, padx=2)
def _init_results_box(self, parent): innerframe = Frame(parent) i1 = Frame(innerframe) i2 = Frame(innerframe) vscrollbar = Scrollbar(i1, borderwidth=1) hscrollbar = Scrollbar(i2, borderwidth=1, orient='horiz') self.results_box = Text(i1, font=tkFont.Font(family='courier', size='16'), state='disabled', borderwidth=1, yscrollcommand=vscrollbar.set, xscrollcommand=hscrollbar.set, wrap='none', width='40', height='20', exportselection=1) self.results_box.pack(side='left', fill='both', expand=True) self.results_box.tag_config(self._HIGHLIGHT_WORD_TAG, foreground=self._HIGHLIGHT_WORD_COLOUR) self.results_box.tag_config(self._HIGHLIGHT_LABEL_TAG, foreground=self._HIGHLIGHT_LABEL_COLOUR) vscrollbar.pack(side='left', fill='y', anchor='e') vscrollbar.config(command=self.results_box.yview) hscrollbar.pack(side='left', fill='x', expand=True, anchor='w') hscrollbar.config(command=self.results_box.xview) #there is no other way of avoiding the overlap of scrollbars while using pack layout manager!!! Label(i2, text=' ', background=self._BACKGROUND_COLOUR).pack(side='left', anchor='e') i1.pack(side='top', fill='both', expand=True, anchor='n') i2.pack(side='bottom', fill='x', anchor='s') innerframe.pack(side='top', fill='both', expand=True)
def initUI(self): self.parent.title("Review") self.pack(fill=BOTH, expand=True) frame1 = Frame(self) frame1.pack(fill=X) lbl1 = Label(frame1, text="Title", width=6) lbl1.pack(side=LEFT, padx=5, pady=5) entry1 = Entry(frame1) entry1.pack(fill=X, padx=5, expand=True) frame2 = Frame(self) frame2.pack(fill=X) lbl2 = Label(frame2, text="Author", width=6) lbl2.pack(side=LEFT, padx=5, pady=5) entry2 = Entry(frame2) entry2.pack(fill=X, padx=5, expand=True) frame3 = Frame(self) frame3.pack(fill=BOTH, expand=True) lbl3 = Label(frame3, text="Review", width=6) lbl3.pack(side=LEFT, anchor=N, padx=5, pady=5) txt = Text(frame3) txt.pack(fill=BOTH, pady=5, padx=5, expand=True)
def initUI(self): self.parent.title("Windows") self.pack(fill=BOTH, expand=True) self.columnconfigure(1, weight=1) self.columnconfigure(3, pad=7) self.rowconfigure(3, weight=1) self.rowconfigure(5, pad=7) lbl = Label(self, text="Windows") lbl.grid(sticky=W, pady=4, padx=5) area = Text(self) area.grid(row=1, column=0, columnspan=2, rowspan=4) abtn = Button(self, text="Activate") abtn.grid(row=1, column=3) cbtn = Button(self, text="Close") cbtn.grid(row=2, column=3, pady=4) hbtn = Button(self, text="Help") hbtn.grid(row=5, column=0, padx=5) obtn = Button(self, text="OK") obtn.grid(row=5, column=3)
def _make_rcv_log(self): # make receive log recvLogFrame = Frame(self, width=400, height=200) recvLogFrame.style = self.style recvLogFrame.grid(row=2, column=0, padx=2, pady=2, sticky=N + S + E + W) self.start_stop_button = Button(self, text="Stop", command=self.start_stop_clicked) self.start_stop_button.style = self.style self.start_stop_button.grid(row=2, column=1, padx=2, pady=2, sticky=N + S + E + W) # make a scrollbar self.scrollbar = Scrollbar(recvLogFrame) self.scrollbar.pack(side=RIGHT, fill=Y) # make a text box to put the serial output self.log = Text(recvLogFrame, width=50, height=30, takefocus=0, borderwidth=1, relief='ridge') self.log.pack(fill=BOTH, expand=True) # attach text box to scrollbar self.log.config(yscrollcommand=self.scrollbar.set) self.scrollbar.config(command=self.log.yview)
def __init__(self, master, title, text): Toplevel.__init__(self, master=master) self.title(title) fra = Frame(self) fra.grid(row=0, column=0, pady=5, padx=5) self.tx = Text(fra, width=130, height=20, wrap=WORD) scr = Scrollbar(fra, command=self.tx.yview) self.tx.configure(yscrollcommand=scr.set) self.tx.pack(side=LEFT) scr.pack(side=RIGHT, fill=Y) self.tx.bind('<Enter>', lambda e: self._bound_to_mousewheel(e, self.tx)) self.tx.bind('<Leave>', self._unbound_to_mousewheel) self.tx.insert(END, text) self.tx.configure(state='disabled') if platform == "darwin": button_font = Font(family='Arial', size=15) else: button_font = Font(font=Button()["font"]) closeTopolPrevB = Button(self, text='Exit', bg='red', command=self.destroy, font=button_font) closeTopolPrevB.grid(row=1, column=0, pady=5)
def __init__(self, master, side): Frame.__init__(self, master, width=0, height=0, borderwidth=2, background="gray92", relief=GROOVE) self.pack(side=side, anchor=NW) label = Label(self, text="Logs", bg="gray78", fg="black", font=("Helvetica", 14)) label.pack(side=TOP, padx=147.49, pady=2) self.logsvariable = Text(self, bg="white", height=60, width=50, font=("Silkscreen", 8), wrap='word') self.logsvariable.pack(side=TOP, padx=2, pady=5)
def createWidgets(self): top = self.winfo_toplevel() top.rowconfigure(0, weight=1, minsize=96) top.columnconfigure(0, weight=1) self.columnconfigure(0, weight=1) self.rowconfigure(0, minsize=24) self.lbl_pretext = Label(self, text="Update progress:") self.lbl_pretext.grid(row=0, sticky="w") self.rowconfigure(1, minsize=48, weight=1) self.txt_messages = Text(self) self.txt_messages.grid(row=1, sticky="nsew") self.txt_messages.config(selectbackground="#d2d3bd") self.txt_messages.tag_config("green", foreground="darkgreen") self.txt_messages.tag_config("blue", foreground="darkblue") self.txt_messages.tag_config("red", foreground="darkred") self.rowconfigure(2, minsize=24) self.btn_quit = Button(self, text="Quit", command=self.quit) self.btn_quit.grid(row=2, sticky="ew") self.write("Process started\n-----\n", "blue") self.update()
def _calltip_window(parent): # htest # from Tkinter import Toplevel, Text, LEFT, BOTH top = Toplevel(parent) top.title("Test calltips") top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200, parent.winfo_rooty() + 150)) text = Text(top) text.pack(side=LEFT, fill=BOTH, expand=1) text.insert("insert", "string.split") top.update() calltip = CallTip(text) def calltip_show(event): calltip.showtip("(s=Hello world)", "insert", "end") def calltip_hide(event): calltip.hidetip() text.event_add("<<calltip-show>>", "(") text.event_add("<<calltip-hide>>", ")") # - 2016 9 28 -- text.event_add('<<calltip-show>>', '<less>') text.event_add('<<calltip-hide>>', '<greater>') # --- text.bind("<<calltip-show>>", calltip_show) text.bind("<<calltip-hide>>", calltip_hide) text.focus_set()
def __init__(self, master, width=0, height=0, **kwargs): self.width = width self.height = height Frame.__init__(self, master, width=self.width, height=self.height) self.text_widget = Text(self, **kwargs) self.text_widget.pack(expand=YES, fill=BOTH)
def startUI(self): self.parent.title("Testing") self.file_list = listdir(getcwd()) fileBox = Listbox(self.parent, selectmode=SINGLE) fileBox.pack() fileBox.grid(column=0, row=1, columnspan=3, rowspan=10, sticky=N + S) textBox = Text(self.parent) textBox.grid(column=4, row=0, columnspan=4, rowspan=10, sticky=N + S + E) ipBox = Entry(self.parent) ipBox.grid(column=0, row=0) btn = Button(text="Open ->", command=lambda: self.readFile(fileBox, textBox)) btn.grid(column=3, row=2) btnFire = Button(text="Fire away!", command=lambda: self.fireTorpedoes(ipBox, textBox)) btnFire.grid(column=3, row=3) scrlBar = Scrollbar(self.parent, command=textBox.yview) scrlBar.grid(column=8, row=0, rowspan=10, sticky=N + S) textBox.config(yscrollcommand=scrlBar.set) for i in self.file_list: fileBox.insert(END, i)
def __init__(self, master): #min and max size of window #master.minsize(width=410, height=680) #master.maxsize(width=410, height=680) #end #title of window master.title("Airmon-ng") #end #for the style of fonts self.customFont = tkFont.Font(family="Helvetica", size=15) self.myfont = tkFont.Font(family="Helvetica", size=12) self.myfont2 = tkFont.Font(family="Helvetica", size=10) self.headerfont=tkFont.Font(family="Helvetica", size=20) #end #content frame self.frame_content = Frame(master, bg="white") self.frame_content.pack(fill=BOTH, side=TOP, expand=True) Label(self.frame_content, text = 'Airmon-ng',font=self.headerfont, bg="white").grid(row = 0, column = 0) btndetect=Button(self.frame_content, text = 'Detect', command =self.canvas_detect, height=2, width=15, font=self.customFont).grid(row = 1, column = 0, padx = 5, pady = 5) #Mycanvas=Canvas(self.frame_content, height=200, width=200, bd=2).grid(row = 1, column = 1) #listbox1 lil1=Listbox(self.frame_content,bg="black", fg="white", font=self.myfont) lil1.grid(row = 1, column = 1) #end #listbox2 lil2=Listbox(self.frame_content,bg="black", fg="white", font=self.myfont) lil2.grid(row = 3, column = 1) #end Label(self.frame_content, text = 'Kill these processes',font=self.myfont, bg="white").grid(row = 2, column = 1) Button(self.frame_content, text = 'Check', command =self.canvas_detect_check, height=2, width=15, font=self.customFont).grid(row = 3, column = 0, padx = 5, pady = 5) #canvas2=Canvas(self.frame_content, height=200, width=200, bd=2).grid(row = 3, column = 1) Button(self.frame_content, text = 'Kill', height=2, width=15, font=self.customFont, command=self.killprocess).grid(row = 4, column = 0, padx = 1, pady = 1) self.mykill=Text(self.frame_content, height=2, width=15, font=self.customFont) self.mykill.grid(row = 4, column = 1, padx = 1, pady = 1) btnstart=Button(self.frame_content, text = 'Start', command=self.item_selStart, height=2, width=15, font=self.customFont).grid(row = 5, column = 0, padx = 1, pady = 5) #btnstart.bind('<ListboxSelect>', self.OnDouble) Button(self.frame_content, text = 'Stop', height=2, width=15, font=self.customFont, command=self.item_selStop).grid(row = 5, column = 1, padx = 1, pady = 5) Label(self.frame_content, text = 'www.hiteshchoudhary.com',font=self.myfont, bg="white").grid(row = 6, column = 0, columnspan=2) self.lilnew1=Listbox(self.frame_content,bg="black", fg="white", font=self.myfont, selectmode=SINGLE) self.lilnew1.grid(row = 1, column = 1) self.lilnew2=Text(self.frame_content,bg="black", fg="white", font=self.myfont, width=20, height=12) self.lilnew2.grid(row = 3, column = 1)
def make_widgets(self): sbar = Scrollbar(self) text = Text(self, relief=SUNKEN) sbar.config(command=text.yview) # xlink sbar and text text.config(yscrollcommand=sbar.set) # move one moves other sbar.pack(side=RIGHT, fill=YES) # pack first=clip last text.pack(side=LEFT, expand=YES, fill=BOTH) # text clipped first self.text = text
def makewidgets(self): sbar = Scrollbar(self) text = Text(self, relief=SUNKEN) sbar.config(command=text.yview) text.config(yscrollcommand=sbar.set) sbar.pack(side=RIGHT, fill=YES) text.pack(side=LEFT, expand=YES, fill=BOTH) self.text = text
def body( self, master ): theRow = 0 Label( master, text="Font Family" ).grid( row=theRow, column=0 ) Label( master, text="Font Size" ).grid( row=theRow, column=2 ) theRow += 1 # Font Families fontList = ttk.Combobox( master, height=10, textvariable=self._family ) fontList.grid( row=theRow, column=0, columnspan=2, sticky=N+S+E+W, padx=10 ) rawfamilyList = list(tkFont.families( )) rawfamilyList.sort() # print rawfamilyList familyList=[] for family in rawfamilyList: if family[0] == '@': continue familyList.append(family) fontList.configure( values=familyList ) fontList.bind('<<ComboboxSelected>>', self.selectionChanged) # Font Sizes sizeList = ttk.Combobox( master, height=10, width=5, textvariable=self._sizeString ) sizeList.grid( row=theRow, column=2, columnspan=2, sticky=N+S+E+W, padx=10 ) sizes=[] for size in xrange( 10,50 ): sizes.append( str(size) ) sizeList.configure( values=sizes) sizeList.bind('<<ComboboxSelected>>', self.selectionChanged) # Styles if self._showStyles is not None: theRow += 1 if self._showStyles in ( FontChooser.ALL, FontChooser.BASIC ): Label( master, text='Styles', anchor=W ).grid( row=theRow, column=0, pady=10, sticky=W ) theRow += 1 Checkbutton( master, text="bold", command=self.selectionChanged, offvalue='normal', onvalue='bold', variable=self._weight ).grid(row=theRow, column=0) Checkbutton( master, text="italic", command=self.selectionChanged, offvalue='roman', onvalue='italic', variable=self._slant ).grid(row=theRow, column=1) if self._showStyles == FontChooser.ALL: Checkbutton( master, text="underline", command=self.selectionChanged, offvalue=False, onvalue=True, variable=self._isUnderline ).grid(row=theRow, column=2) Checkbutton( master, text="overstrike", command=self.selectionChanged, offvalue=False, onvalue=True, variable=self._isOverstrike ).grid(row=theRow, column=3) # Sample Text theRow += 1 Label( master, text='Sample Text', anchor=W ).grid( row=theRow, column=0, pady=10, sticky=W ) theRow += 1 self.sampleText = Text( master, height=11, width=70 ) self.sampleText.insert( INSERT,'ABC...XYZ\nabc....xyz', 'fontStyle' ) self.sampleText.config( state=DISABLED ) self.sampleText.tag_config( 'fontStyle', font=self._currentFont ) self.sampleText.grid( row=theRow, column=0, columnspan=4, padx=10 )
def consolePanel(self): tmpFrm = Frame(self.bgndFrm, borderwidth=5, relief=RAISED) tmpFrm.grid() tmpFrm.grid(column=0, row=1) self.scrollbar = Scrollbar(tmpFrm) self.scrollbar.pack(side=RIGHT, fill=Y) self.log = Text(tmpFrm, wrap=WORD, yscrollcommand=self.scrollbar.set) self.log.pack() self.scrollbar.config(command=self.log.yview)
def __init__(self, master): self._master = master self.interior = Frame(master, class_="Consent") instruction_label_frame = Frame(self.interior, class_="Consent") instruction_label_frame.pack(fill=X) self.title_font = tkfont.Font(family='Helvetica', size=18, weight="bold", slant="italic") self._label_instruction = Label(instruction_label_frame, text="WELCOME!", font=self.title_font) self._label_instruction.pack() instruction_frame = Frame(self.interior, class_="Instruction") instruction_frame.pack(fill=X) self.content_font = tkfont.Font(family='Helvetica', size=14) self._text_instruction = Text(instruction_frame, font=self.content_font, wrap=WORD) # wrap: to manage hypenation self._text_instruction.pack(fill=X, side=LEFT) quote = """You are invited to participate in a study of the development of a dialogue agent. You will be asked 10 casual conversation questions in total. After you answer each conversation's question, the system will generate a reply question. After that, the system will ask your opinion regarding the quality of reply question in a scale-based survey. There are no “right” or “wrong” answers; we just want to know what you think and feel about the system. PARTICIPATION Your participation in this study is voluntary. You may refuse to take part in the study or exit the study at any time without penalty. You are free to decline to answer any particular question in the conversation you do not wish to answer for any reason. CONFIDENTIALITY Your responses will be stored in an electronic format. Your responses to the conversation will be made anonymized in written materials resulting from the study. CONTACT If you have questions at any time about the study or the procedures, you may contact me via e-mail at [email protected]. By clicking the button below, you acknowledge that your participation in the study is voluntary, you are 18 years of age or older, fluent in English, and that you are aware that you may choose to terminate your participation in the study at any time and for any reason. Thank you!""" self._text_instruction.insert(END, quote) #button button_frame = Frame(self.interior, class_="Instruction") button_frame.pack(fill=X) self._button_next = Button(button_frame, text="I agree, begin the study", command=self.close_window, width=50, font=self.content_font) self._button_next.pack() self._button_next = Button( button_frame, text="I disagree, I do not wish to participate", command=self.close_window2, width=50, font=self.content_font) self._button_next.pack()
def pack_all_command_tabs(self): # Combined commands in one tab combined_commands_txt = Text(self.command_notebook) combined_commands_txt.tag_config('highlight', foreground='blue') for command in self.combined_commands: stdin, stdout, stderr = self.ssh.exec_command(command) combined_commands_txt.insert(END, ("===== " + command + " =====\n").encode('utf-8'), ('highlight', )) combined_commands_txt.insert(END, stdout.read()) self.command_notebook.add(combined_commands_txt, text='Info') # Individual commands that get their own tab for command in self.command_list: stdin, stdout, stderr = self.ssh.exec_command(command) command_txt = Text(self.command_notebook) command_txt.insert(END, stdout.read()) self.command_notebook.add(command_txt, text=command)
def __init__(self, parent): Frame.__init__(self, parent, background="white") self.monitor = SerialMonitor() self.parent = parent self.frame = Frame(parent, relief=RAISED, borderwidth=1) self.scrollbar = Scrollbar(parent) self.receive_box = Text(parent, width=10, height=10, takefocus=0) self.transmit_box = Text(parent, width=10, height=10, takefocus=0) self.send_button = Button(parent, text="Send", command=self.send_message) self.initUI() self.process_serial_input()
def insert_text_field(self, txt): frame = Frame(self.frame) frame.grid(row=self.row, column=0) frame.pack(fill="x") label = Label(frame, text=txt, width=6) label.pack(side="left", anchor="n", padx=5, pady=5) entry = Text(frame) entry.pack(fill="both", pady=5, padx=5, expand=True) textfield = [frame, label, entry] return textfield
def mkMessageArea(self, f): self.text = Text(f, height=36, width=64) self.text.configure(font=("Courier", 11, "bold"), bg="black", fg="green") self.scroll = Scrollbar(f, command=self.text.yview) self.text.configure(yscrollcommand=self.scroll.set) self.text.pack(side=LEFT, padx=3, pady=2) self.scroll.pack(side=RIGHT, fill=Y, padx=3, pady=2)
def getSmallText(parent, text): t = Text(parent) t["height"] = 6 t["width"] = 50 t["background"] = rootColor # unclicked background t["borderwidth"] = 0 t["foreground"] = "black" # unclicked text t["font"] = ("Helvetica", 10) t.insert(END, text) t.grid(sticky=W) return t
def getLargeTextBlue(parent, text): t = Text(parent) t["height"] = 1 t["width"] = 32 t["background"] = blue1 # unclicked background t["borderwidth"] = 0 t["foreground"] = "black" # unclicked text t["font"] = ("Helvetica", 15, "bold") t.insert(END, text) t.grid(sticky=W) return t
def __init__(self, master=None): Frame.__init__(self, master) self.pack() Label(self, text="Click open to select mmssms.db file:").pack(side="top") Button(self, text="Open mmssms.db", command=self.open_file).pack(side="top") Label(self, text="After that click Save to save the result:").pack(side="top") self.save = Button(self, text="Save results", command=self.save_results, state="disabled") self.save.pack(side="top") self.msg = Text(self, height=0, width=10, relief="flat", bg=self["bg"], wrap="word") self.msg.pack(expand=True, fill="both") self.msg["state"] = "disabled"
def __init__(self): self.root = Tk() self.input_type = Tkinter.IntVar() self.input_type.set(1) self.normalize_data = Tkinter.IntVar() self.normalize_data.set(1) self.root.title("Code energy calculator") self.left_frame = LabelFrame(self.root, text="Input and output") self.left_frame.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=True, padx=(10, 5), pady=10) self.right_frame = LabelFrame(self.root, text="Code") self.right_frame.pack(side=Tkinter.RIGHT, fill=Tkinter.BOTH, expand=True, padx=(5, 10), pady=10) code_hscroll = Scrollbar(self.right_frame, orient=Tkinter.HORIZONTAL) code_hscroll.pack(side=Tkinter.BOTTOM, fill=Tkinter.X) code_vscroll = Scrollbar(self.right_frame) code_vscroll.pack(side=Tkinter.RIGHT, fill=Tkinter.Y) self.code_text = Text(self.right_frame, wrap=Tkinter.NONE, xscrollcommand=code_hscroll.set, yscrollcommand=code_vscroll.set) self.code_text.pack() self.code_text.insert(Tkinter.INSERT, DEFAULT_CODE) code_hscroll.config(command=self.code_text.xview) code_vscroll.config(command=self.code_text.yview) self.input_file_entry =\ self.create_and_add_file_field(self.left_frame, "Input file", 5, False) self.spherical_coord_option =\ Radiobutton(self.left_frame, text="Spherical coordinates", variable=self.input_type, value=1) self.spherical_coord_option.pack(anchor=Tkinter.W) self.cartesian_coord_option =\ Radiobutton(self.left_frame, text="Cartesian coordinates", variable=self.input_type, value=2) self.cartesian_coord_option.pack(anchor=Tkinter.W) self.spherical_coord_option.select() self.output_file_entry =\ self.create_and_add_file_field(self.left_frame, "Output file", 5, True) self.normalize_check = Checkbutton(self.left_frame, text="Normalize data", variable=self.normalize_data, offvalue=0, onvalue=1) self.normalize_check.pack() self.normalize_check.deselect() self.do_button = Button(self.left_frame, text="Run", command=self.run) self.do_button.pack(side=Tkinter.BOTTOM, pady=(0, 10))
def display_question(self, title, question, answer): top = Frame(self.master) top.pack() label = Label(top, text=question) label.pack() answer_text = Text(top) answer_text.insert(INSERT, answer) button = Button( top, text="Got the answer?", command=lambda answer=answer_text: self.show_answer(answer)) button.pack()
def __init__(self, master): self.master = master master.title("RPI-Youtube player") self.label = Label(master, text="Type in a valid youtube link") self.label.pack() self.url = Text(master, height=2, width=30) self.url.pack() self.greet_button = Button(master, text="Play", command=self.play) self.greet_button.pack()