def test_autocompletecombobox(self): box = AutocompleteCombobox(self.window, completevalues=["Apple", "Pear", "Banana"]) box.pack() self.window.update() box.insert(0, "A") self.window.update() for item in ["A", "Up", "Down", "Left", "Right", "Return"]: box.handle_keyrelease(TestEvent(item)) box.autocomplete(0) box.set_completion_list(["Apply"])
def test_autocompletecombobox(self): box = AutocompleteCombobox(self.window, completevalues=["Apple", "Pear", "Banana"]) box.pack() self.window.update() self.assertIn('completevalues', box.keys()) self.assertEqual(box['completevalues'], sorted(["Apple", "Pear", "Banana"])) box.insert(0, "A") self.window.update() for item in ["A", "Up", "Down", "Left", "Right", "Return"]: box.handle_keyrelease(TestEvent(item)) box.autocomplete(0) box.set_completion_list(["Apply"]) self.assertEqual(box['completevalues'], ["Apply"]) box['completevalues'] = ["Test"] self.assertEqual(box['completevalues'], ["Test"])
deg_rad_button.grid(row=6,column=1,sticky='news',padx=5,pady=5) deg_rad_button.bind('<Return>',lambda event: deg_rad_function()) deg_rad_button.bind('<FocusIn>',lambda event: deg_rad_button.config(bg='MediumPurple1')) deg_rad_button.bind('<FocusOut>',lambda event: deg_rad_button.config(bg='hot pink') if deg_rad_var.get()==0 else deg_rad_button.config(bg='turquoise1')) button_backspace=HoverButton(window,text='\u232b',font=font,fg="Black",borderwidth=0,bg='white',command=backspace,activebackground=active_button_background,takefocus=0) button_backspace.grid(row=6,column=2,sticky='news',padx=5,pady=5) button_clear_all=HoverButton(window,text='\u239a',font=font,fg="Black",borderwidth=0,bg='white',command=clear_input,activebackground=active_button_background,takefocus=0) button_clear_all.grid(row=6,column=3,sticky='news',padx=5,pady=5) function_dropdown=AutocompleteCombobox(window,width=5,textvariable=function_input_var,font=font) function_dropdown['completevalues']=function_list function_dropdown.bind('<Key>',function_select) function_dropdown.bind('<Double-Button-1>',function_select) function_dropdown.autocomplete(delta=-6) function_dropdown.current() function_dropdown.grid(row=7,column=0,sticky='news',padx=5,pady=5,columnspan=3) save_and_clear_all=HoverButton(window,text='\u21ba',font=font,fg="Black",borderwidth=0,bg='white',command=save_and_clear_input,activebackground=active_button_background,takefocus=0) save_and_clear_all.grid(row=7,column=3,sticky='news',padx=5,pady=5) button_Ans=HoverButton(window,text='Ans',font=font,fg="Black",borderwidth=0,bg='white',command=lambda: input_to_input_var('Ans'),activebackground=active_button_background,takefocus=0) button_Ans.grid(row=7,column=4,sticky='news',padx=5,pady=5) size_spinbox=tk.Spinbox(window,from_=0,to=100,font=font,fg="Black",bg="white",textvariable=size_var,width=4,command=lambda: resize(1),takefocus=1) size_spinbox.bind('<Key>',resize) size_spinbox.grid(row=2,column=4,sticky='news',padx=5,pady=5) button_pi=HoverButton(window,text='\u03c0',font=font,fg="Black",borderwidth=0,bg='white',command=lambda: input_to_input_var('pi'),activebackground=active_button_background,takefocus=0) button_pi.grid(row=3,column=4,sticky='news',padx=5,pady=5)