CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

CtkTabView Tab Changed Event not implemented

Open JJenkinsDaxsonics opened this issue 2 years ago • 4 comments

Is there any way to bind to the Tab Changed event? I've tried <<NotebookTabChanged>> but the 'Not Implemented' error keeps being reported.

<<Visibility>> works for setup but there is no way to easily tear down tabs when they are changed.

JJenkinsDaxsonics avatar Aug 11 '23 15:08 JJenkinsDaxsonics

I checked the code for it it's just straight up not implemented idk I'm looking for a solution also cause I need the event and I don't want to have to change the code cause I'm making something public

Turnrp avatar Aug 21 '23 19:08 Turnrp

@Turnrp I got around this by using the after() method in the tkinter app. Just call check_tab_change() once in your app initialization

# Create main tabs for the different tests
self.tabview = ctk.CTkTabview(self)
self.tabdict = {}

tabname = "Burn-in Test"
self.tabview.add(tabname)
self.burn_in_tab = BurnInTab(self, self.tabview.tab(tabname), tabname)
self.tabdict[tabname] = self.burn_in_tab
self.tabview.set(tabname)

	# Check if the current tab has changed
	# If so, restart the tests
	# This event is polled every 100 ms
	def check_tab_change(self):
		global last_tab
		current_tab = self.tabview.get()
		if 'last_tab' in globals():
			if current_tab != last_tab:
				for tab in self.tabdict.values():
					tab.reset_test()
		last_tab = current_tab
		self.after(100, self.check_tab_change)

ghost avatar Aug 22 '23 16:08 ghost

@JJenkinsDaxsonics oh cool thank you!

Turnrp avatar Aug 22 '23 17:08 Turnrp

Any updates or plans on implementing this?

JamesonBeebe avatar Jul 24 '24 13:07 JamesonBeebe