ubanide

MessageBox Not getting focus when run in ArcMap

Discussion created by ubanide on Mar 22, 2012
Latest reply on Mar 22, 2017 by gwen.laselva
I have been working on a system that is not connected to this net work so I am going to have type a shorted version
So I create a app window a few buttons and then I do some logic.  Then I ask a question in a askquestion MessageBox.  The problem is this code works when I run it in IDEL.  But when I run as a script from ArcMAP the askquestion MessageBox doesn't get mouse focus.  So the user can't say yes or no.  Why no focus?

Thanks

import arcpy
from arcpy import env

import Tkinter as tk
import tkMessageBox


root = tk.Tk()

maintitle = tk.Label(root,"Add things to the list")
button1 = tk.Button(root,text="Help",commend=help_call)

buttonq = tk.Button(root,text="Quit",commend=quit_calll)


## do some logic in arcpy

found_one = 0

for field in fieldlist:
    if field[0:3] == "RM_"   # see is any fields start with RM_
         found_one += 1

if found_one == 0:
     lbAnswer = tkMessageBox.askquestion("No RM found"," not RM_ fields found create them?")
     if (lbAnswer == "yes":
          createthe_rm_fields(inputfile)
     else:
          root.destroy()

root.mainloop()

Outcomes