I am new to Python and is about to build a GUI using tkinter. The GUI consists of a Notebook and I am trying to create a event handler for when the user click with the mouse on the different tabs. However when I click on a tab, the handlerfunction 'works' but it seems the selected tab is not 'updated' before the function is called.
As a sidenote: So far I have mainly used 'Tkinter 8.5 reference: a GUI for Python (Shipman)'. Please see code below. Grateful for any suggestions!
from tkinter import *
import tkinter.ttk as ttk
root = Tk()
note = ttk.Notebook(root)
tab1 = Frame(note,width = 10)
tab2 = Frame(note,width = 10)
tab3 = Frame(note,width = 10)
note.add(tab1, text = "Tab One")
note.add(tab2, text = "Tab Two")
note.add(tab3, text = "Tab Three")
note.grid()
def personalData(event):
if event.widget.index("current") == 0:
print("One!")
else:
print("Not One!")
note.bind('<1>',personalData)
root.mainloop()