Best Python code snippet using Kiwi_python
controller.py
Source:controller.py  
...41		self.sweep = SweepSpectrogram(model, self)42		# Start with instantaneous spectrogram.43		self._current_view = self.instant44		# self.change_to_sweep()45	def change_view(self, view):46		"""Change to specified view."""47		self._prev_view = self._current_view48		self._current_view = view49	def current(self):50		"""Return current view."""51		return self._current_view52	def message_dialog(self, text, **kwargs):53		"""Open a message dialog which goes back to the previous view when54		canceled.55		"""56		self.change_view(MessageDialog(self.model, text,57			cancel=self._change_to_previous, **kwargs))58	def number_dialog(self, label_text, unit_text, **kwargs):59		"""Open a number dialog which goes back to the previous view when60		canceled.61		"""62		self.change_view(NumberDialog(self.model, label_text, unit_text,63			cancel=self._change_to_previous, **kwargs))64	def puase_dialog(self, label_text, unit_text, **kwargs):65		"""Open a number dialog which goes back to the previous view when66		canceled.67		"""68		self.change_view(PuaseDialog(self.model, label_text, unit_text,69			cancel=self._change_to_previous, **kwargs))70	def _change_to_previous(self, *args):71		# Change to previous view, note can only go back one level.72		self.change_view(self._prev_view)73	# Functions that switch between views and are able to work as a click handler74	# because they ignore any arguments passed in (like clicked button).75	def change_to_main(self, *args):76		"""Change to main spectrogram view (either instant or waterfall depending77		on what was the last main view).78		"""79		self.change_view(self._main_view)80	def toggle_main(self, *args):81		"""Switch between instantaneous and waterfall spectrogram views."""82		if self._current_view == self.sweep:83			self.change_to_instant()84		else:85			self.change_to_sweep()86	def sweep_change(self, *args):87		self.change_to_sweep()88	def instant_change(self, *args):89		self.change_to_instant()90		91	def toggle_sweep(self, *args):92		"""Switch between instantaneous and waterfall spectrogram views."""93		if self._current_view == self.sweep:94			self.change_to_instant()95		else:96			self.change_to_sweep()97	def change_to_instant(self, *args):98		"""Change to instantaneous spectrogram view."""99		self._main_view = self.instant100		self.change_view(self.instant)101	def change_to_waterfall(self, *args):102		"""Change to waterfall spectrogram view."""103		self._main_view = self.waterfall104		self.change_view(self.waterfall)105	def change_to_sweep(self, *args):106		"""Change to instantaneous spectrogram view."""107		self._main_view = self.sweep108		self.change_view(self.sweep)109	def change_to_settings(self, *args):110		"""Change to settings list view."""111		# Create a new settings list view object because the setting values might112		# change and need to be rendered with different values.113		self.change_view(SettingsList(self.model, self))114	def change_to_page1(self, *args):115		"""Change to settings list view."""116		# Create a new settings list view object because the setting values might117		# change and need to be rendered with different values.118		self.change_view(SettingsList(self.model, self))119	def change_to_page2(self, *args):120		"""Change to settings list view."""121		# Create a new settings list view object because the setting values might122		# change and need to be rendered with different values....app.py
Source:app.py  
...24    app_view.sort_view = sort_view25    def change_nb(event):26        app_view.render_content(int(app_view.change_view.entry_text.get()))27    app_view.change_nb = change_nb28    change_view(app_view.view)29    change_view.view.grid(padx=20, ipadx=5)30    change_view.button.bind('<Button-1>', app_view.change_nb)31    app_view.change_view = change_view32    def get_data(event):33        ip = app_view.header_view.get_ip()34    app_view.get_data = get_data35    submit_view(app_view.view)36    submit_view.view.grid(padx=20, ipadx=5, pady=20)37    submit_view.button.bind('<Button-1>', app_view.get_data)38    submit_controller(content_view, header_view, sort_view)39    submit_view.set_controller(submit_controller)40    app_view.submit_view = submit_view41    def set_controller(_controller):42        app_view.controller = _controller43    app_view.set_controller = set_controller44    def render_change():45        app_view.change_view.view.destroy()46        change_view(app_view.view)47        change_view.view.grid(padx=20, ipadx=5)48        change_view.button.bind('<Button-1>', app_view.change_nb)49        app_view.change_view = change_view50    app_view.render_change = render_change51    def render_sort():52        app_view.sort_view.view.destroy()53        sort_view(app_view.view)54        sort_view.view.grid(padx=20, ipadx=5)55        app_view.sort_view = sort_view56    app_view.render_sort = render_sort57    def render_submit():58        result_view = app_view.submit_view.controller.result59        graph_view = app_view.submit_view.controller.graph60        tree_view = app_view.submit_view.controller.tree...change.py
Source:change.py  
1import tkinter as tk2from functools import partial3def change_view(root):4    change_view.view = tk.LabelFrame(root)5    label = tk.Label(change_view.view, text="        Numbers of subnests:                 ")6    change_view.entry_text = tk.StringVar(change_view.view)7    entry = tk.Entry(change_view.view, textvariable=change_view.entry_text, highlightthickness=2, width="15")8    def change_number():9        return change_view.entry_text.get()10    change_view.button = tk.Button(change_view.view, text="   Change    ",11                            command=partial(change_number))12    label.grid(column=0, row=0)13    entry.grid(column=1, row=0)14    change_view.button.grid(column=2, row=0)...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
