python 3.x - tkinter messagebox link to notebook page -


referwork = ttk.notebook(root, style =".tnotebook") f1 = ttk.frame(referwork) f2 = ttk.frame(referwork) referwork.add(f1, text="search", padding = 1) referwork.add(f2, text="add/delete", padding = 1)  #referwork.configure (height = 500, width = 800) referwork.grid(row=0, column=0, sticky=(n,w,s,e)) 

i have used above create two-tab notebook. on first search performed. want have alert in message box appear messagebox.askyesno , when 'yes' selected focus moves second page of notebook

messagebox.askyesno(0.0,'"{0}"{1} \n {2}\n'.format(search_analyte.get(),'  not in database.','add,if appropriate'))         if true: 

is far have got. cannot figure out how 'open' second page using dialogue , conditional. many help

use notebook.select(tab) method, tab 1 of notebook child widgets.

from tkinter import * tkinter.ttk import * tkinter.messagebox import askyesno  def open_first():     referwork.select(f1) def open_second():     if askyesno('title', 'press "yes" open second page') == yes:         referwork.select(f2)  root = tk() referwork = notebook(root, style =".tnotebook") f1 = frame(referwork) f2 = frame(referwork) button(f1, text='go =>', command=open_second).pack(padx=100, pady=100) button(f2, text='<= go', command=open_first).pack(padx=100, pady=100) referwork.add(f1, text="search", padding = 1) referwork.add(f2, text="add/delete", padding = 1) referwork.grid(row=0, column=0, sticky=(n,w,s,e)) root.mainloop() 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -

matlab - How to equate a structure array to structure array -