<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cannot exit a Python Script from ArcMap in Python AddIns Questions</title>
    <link>https://community.esri.com/t5/python-addins-questions/cannot-exit-a-python-script-from-arcmap/m-p/803030#M66</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, fixed this, I put root.destroy in the command on the Button and it closes the menu box when being ran from ArcMap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Button(root, text='Close',width=20,bg='brown',fg='white', font="Arial 8 bold", command=root.destroy).place(x=39,y=272)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 May 2019 16:49:41 GMT</pubDate>
    <dc:creator>DaleShearer</dc:creator>
    <dc:date>2019-05-10T16:49:41Z</dc:date>
    <item>
      <title>Cannot exit a Python Script from ArcMap</title>
      <link>https://community.esri.com/t5/python-addins-questions/cannot-exit-a-python-script-from-arcmap/m-p/803029#M65</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for looking at my question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a Python toolbar with a button that runs a Python script that displays a menu box.&amp;nbsp; This is being ran through ArcMap.&amp;nbsp; I open my mxd, display the menu, now I want to close it when I am finished and that is the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am calling:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def quit():&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; root.destroy()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to close the menu from a button command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run the script in pyscripter and display the menu box and hit the close button it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I have the menu box open in ArcMap and hit the close button I get the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "C:\Python27\ArcGIS10.5\Lib\lib-tk\Tkinter.py", line 1542, in __call__&lt;BR /&gt; return self.func(*args)&lt;BR /&gt; File "D:\Applications\Python\Layers.py", line 49, in quit&lt;BR /&gt; root.destroy()&lt;BR /&gt;NameError: global name 'root' is not defined&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The next issue I see is how to close the Python box when I close ArcMap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for looking at my question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 May 2019 15:42:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/cannot-exit-a-python-script-from-arcmap/m-p/803029#M65</guid>
      <dc:creator>DaleShearer</dc:creator>
      <dc:date>2019-05-10T15:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot exit a Python Script from ArcMap</title>
      <link>https://community.esri.com/t5/python-addins-questions/cannot-exit-a-python-script-from-arcmap/m-p/803030#M66</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, fixed this, I put root.destroy in the command on the Button and it closes the menu box when being ran from ArcMap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Button(root, text='Close',width=20,bg='brown',fg='white', font="Arial 8 bold", command=root.destroy).place(x=39,y=272)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 May 2019 16:49:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/cannot-exit-a-python-script-from-arcmap/m-p/803030#M66</guid>
      <dc:creator>DaleShearer</dc:creator>
      <dc:date>2019-05-10T16:49:41Z</dc:date>
    </item>
  </channel>
</rss>

