Select to view content in your preferred language

MessageBox Not getting focus when run in ArcMap

1222
2
03-22-2012 08:27 AM
WilliamIde
Emerging Contributor
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()

Tags (2)
0 Kudos
2 Replies
WilliamIde
Emerging Contributor
I found a work around by not using tkMessageBox.  Instead I created a dialog class that does that same job.
0 Kudos
GwenLaSelva
Deactivated User

Still no fix for this in ArcGIS 10.5, it appears.

0 Kudos