<p>Dear Tkinter users/developers,</p><p>I&#39;m just starting out in Python Tkinter programming, and I tried to use the Tile module to improve the looks of the Tk program I am writing.</p><p>When I run the script written in &lt;code&gt;&lt;/code&gt; below, it works fine, using the Tile module to make the Tk look ok. However, when I try to use tkMessageBox.showwarning() as in the script, it fails with the error below. I&#39;ve tried to cat | grep for &quot;background&quot; in the files mentionned in the error, but nothing turns up. I can&#39;t find where the &quot;-background&quot; switch is getting stuck in. I know the &quot;background&quot; switch doesn&#39;t work with Tile, but I can&#39;t find it to remove it. Any ideas please?</p>
<p>Thanks,</p><p>Nawal.</p><p>&lt;error&gt;</p><p>/usr/lib/python2.4/site-packages/apt/__init__.py:2: RuntimeWarning: Python C API version mismatch for module apt_pkg: This Python has API version 1013, module apt_pkg has version 1012.<br>
&nbsp; import apt_pkg<br>Traceback (most recent call last):<br>&nbsp; File &quot;./tktest.py&quot;, line 81, in &lt;module&gt;<br>&nbsp;   tkMessageBox.showwarning(&quot;Open file&quot;,&quot;Cannot open this file\n&quot;)<br>&nbsp; File &quot;/usr/lib/python2.5/lib-tk/tkMessageBox.py&quot;, line 85, in showwarning<br>
&nbsp;   return _show(title, message, WARNING, OK, **options)<br>&nbsp; File &quot;/usr/lib/python2.5/lib-tk/tkMessageBox.py&quot;, line 72, in _show<br>&nbsp;   res = Message(**options).show()<br>&nbsp; File &quot;/usr/lib/python2.5/lib-tk/tkCommonDialog.py&quot;, line 48, in show<br>
&nbsp;   s = w.tk.call(self.command, *w._options(self.options))<br>_tkinter.TclError: unknown option &quot;-background&quot;<br><br>&lt;/error&gt;</p><p></p><p>Here&#39;s the script:</p><p>&lt;code&gt;</p><p>#! /usr/bin/env python<br>
<br>from Tkinter import *<br>import tkMessageBox<br><br>def callback():<br>&nbsp;   print &quot;called the callback!&quot;<br><br>root = Tk()<br>root.tk.call(&#39;package&#39;, &#39;require&#39;, &#39;tile&#39;)<br>root.tk.call(&#39;namespace&#39;, &#39;import&#39;, &#39;-force&#39;, &#39;ttk::*&#39;)<br>
root.tk.call(&#39;ttk::setTheme&#39;, &#39;clam&#39;)<br><br>def callback():<br>&nbsp;   print &quot;called the callback!&quot;<br><br># create a toolbar<br>toolbar = Frame(root)<br><br>b = Button(toolbar, text=&quot;new&quot;, width=6, command=callback)<br>
b.pack(side=LEFT, padx=2, pady=2)<br><br>b = Button(toolbar, text=&quot;open&quot;, width=6, command=callback)<br>b.pack(side=LEFT, padx=2, pady=2)<br><br>toolbar.pack(side=TOP, fill=X)<br><br>status = Label(root, text=&quot;&quot;, relief=SUNKEN, anchor=W)<br>
status.pack(side=BOTTOM, fill=X)<br><br># create a menu<br>menu = Menu(root)<br>root.config(menu=menu)<br><br>filemenu = Menu(menu)<br>menu.add_cascade(label=&quot;File&quot;, menu=filemenu)<br>filemenu.add_command(label=&quot;New&quot;, command=callback)<br>
filemenu.add_command(label=&quot;Open...&quot;, command=callback)<br>filemenu.add_separator()<br>filemenu.add_command(label=&quot;Exit&quot;, command=callback)<br><br>#tkMessageBox.showwarning(&quot;Open file&quot;,&quot;Cannot open this file\n&quot;)<br>
<br>mainloop()<br>&lt;/code&gt;</p><p></p><p>-- <br></p>The best way to predict the future is to invent it. - Alan Kay<br><a href="http://www.galileon.co.uk/">http://www.galileon.co.uk/</a><br>