473,761 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tkinter vs. py2exe problem

Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...

I have several dialogs that are derived from the tkSimpleDialog. Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.

Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:

AttributeError: MyDialog instance has no attribute
'buttonbox'

For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------

from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimp leDialog.Dialog )

#--------------------------------------------------------------------------------

And my setup.py file looks like this:

#--------------------------------------------------------------------------------

from distutils.core import setup
import py2exe

setup(console=['tcgui3.py'])

#--------------------------------------------------------------------------------

I'm invoking py2exe like this:

C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog

??????
Dec 5 '07 #1
5 3444
On Dec 5, 9:50 am, msunde...@gmail .com wrote:
Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...

I have several dialogs that are derived from the tkSimpleDialog. Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.

Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:

AttributeError: MyDialog instance has no attribute
'buttonbox'

For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------

from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimp leDialog.Dialog )

#--------------------------------------------------------------------------------

And my setup.py file looks like this:

#--------------------------------------------------------------------------------

from distutils.core import setup
import py2exe

setup(console=['tcgui3.py'])

#--------------------------------------------------------------------------------

I'm invoking py2exe like this:

C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog

??????
Oh yeah... if it matters, I'm using Python 2.5.1 on Win XP, and py2exe
v1.4. I get the same problem using pyinstaller, except it doesn't
show the exception - it just fails to display the buttons.
Dec 5 '07 #2
On Dec 5, 9:50 am, msunde...@gmail .com wrote:
Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...

I have several dialogs that are derived from the tkSimpleDialog. Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.

Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:

AttributeError: MyDialog instance has no attribute
'buttonbox'

For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------

from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimp leDialog.Dialog )

#--------------------------------------------------------------------------------

And my setup.py file looks like this:

#--------------------------------------------------------------------------------

from distutils.core import setup
import py2exe

setup(console=['tcgui3.py'])

#--------------------------------------------------------------------------------

I'm invoking py2exe like this:

C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog

??????
Oh, and it fails when the setup() line in setup.py says
"setup(wind ow=['tcgui3.py'])" as well. Same error.
Dec 5 '07 #3
On Dec 5, 9:50 am, msunde...@gmail .com wrote:
Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...

I have several dialogs that are derived from the tkSimpleDialog. Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.

Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:

AttributeError: MyDialog instance has no attribute
'buttonbox'

For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------

from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimp leDialog.Dialog )

#--------------------------------------------------------------------------------

And my setup.py file looks like this:

#--------------------------------------------------------------------------------

from distutils.core import setup
import py2exe

setup(console=['tcgui3.py'])

#--------------------------------------------------------------------------------

I'm invoking py2exe like this:

C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog

??????
Nevermind. I fixed it. I had a tkSimpleDialog. py in my local
directory that was typed in from an introductory text.

Apparently this was confusing Python. Removing that file, and letting
it find the tkSimpleDialog from Tk makes it work.

Thanks, anyway.
Dec 5 '07 #4
On Dec 5, 10:07 am, msunde...@gmail .com wrote:
On Dec 5, 9:50 am, msunde...@gmail .com wrote:
Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...
I have several dialogs that are derived from the tkSimpleDialog. Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.
Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:
AttributeError: MyDialog instance has no attribute
'buttonbox'
For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------
from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimp leDialog.Dialog )
#--------------------------------------------------------------------------------
And my setup.py file looks like this:
#--------------------------------------------------------------------------------
from distutils.core import setup
import py2exe
setup(console=['tcgui3.py'])
#--------------------------------------------------------------------------------
I'm invoking py2exe like this:
C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog
??????

Nevermind. I fixed it. I had a tkSimpleDialog. py in my local
directory that was typed in from an introductory text.

Apparently this was confusing Python. Removing that file, and letting
it find the tkSimpleDialog from Tk makes it work.

Thanks, anyway.
Ummm... Un-nevermind. I didn't fix it. It's still complaining.
Dec 5 '07 #5
On Dec 5, 10:46 am, msunde...@gmail .com wrote:
On Dec 5, 10:07 am, msunde...@gmail .com wrote:
On Dec 5, 9:50 am, msunde...@gmail .com wrote:
Having a problem with "compiling" a Tkinter/python program using
py2exe (and pyinstaller, for that matter)...
I have several dialogs that are derived from the tkSimpleDialog. Dialog
class. These work just fine if run through the interpreter. When I
"compile" this with py2exe, I don't see any errors, and when I execute
the resulting program, it "appears" to work fine until I invoke one of
the derived dialogs.
Then, I get the "body" of the dialog, but no "OK" or "Cancel" button,
and I get the following exception:
AttributeError: MyDialog instance has no attribute
'buttonbox'
For reference, MyDialog is declared as follows:
#--------------------------------------------------------------------------------
from Tkinter import *
import tkSimpleDialog
class MyDialog(tkSimp leDialog.Dialog )
#--------------------------------------------------------------------------------
And my setup.py file looks like this:
#--------------------------------------------------------------------------------
from distutils.core import setup
import py2exe
setup(console=['tcgui3.py'])
#--------------------------------------------------------------------------------
I'm invoking py2exe like this:
C:\python setup.py py2exe -p Tkinter -p tkSimpleDialog
??????
Nevermind. I fixed it. I had a tkSimpleDialog. py in my local
directory that was typed in from an introductory text.
Apparently this was confusing Python. Removing that file, and letting
it find the tkSimpleDialog from Tk makes it work.
Thanks, anyway.

Ummm... Un-nevermind. I didn't fix it. It's still complaining.
Okay, here's a sample program that fails:

#------------------------------------------------------------------
#!/usr/bin/python

from Tkinter import *
import tkSimpleDialog

class MyDialog(tkSimp leDialog.Dialog ):
def body(self, master):
Label(master, text="Label").g rid()

def apply(self):
print "OK"

if __name__ == "__main__":
root = Tk()
md = MyDialog(root)
mainloop()

#--------------------------------------------

And here's the setup file I'm using with py2exe:

#--------------------------------------------
from distutils.core import setup
import py2exe

opts = {
"py2exe": {
"includes":"tkS impleDialog"
}
}

setup(windows=['hellogui.py'], options=opts)

#--------------------------------------------

Can't make it any simpler than that... I'm so confused!
Dec 5 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6984
by: Anthony Baxter | last post by:
I'm trying to use py2exe and Inno Setup to build an installer for shtoom, which uses tkinter. If I take the py2exe generated directory, and run the executable from there, it works fine. If I add all the files in the directory to an installer (including the tk-8.4 and tcl-8.4 directories), it builds an installer fine. But when I run the installer, and install to, say c:/Program Files/Shtoom,
1
2614
by: | last post by:
I've just started playing with py2exe and tried to create a distribution for a slightly complex Tkinter program that refers to a class in another file. I just try to create an .exe for the main Tkinter program but it's not functional; setup says that it's missing SSL and some java classes which I didn't know my program was using. Anyone run across this before, or have any examples of a working distribution? Thanks,
0
1754
by: erkidevries | last post by:
Problem compiling Tkinter program with bmp images (using py2exe) I have a Tkinter gui program that uses bmp as backgrounds. The program itself works when I run from the source. I placed the .bmp files in the same folder as the script. I run my .py script (from IDLE) and all the backgrounds are loaded as intended. in my script I load the images like this:
0
1151
by: Robin Becker | last post by:
Don't know if this is the right place to ask, but has anyone considered using something like tcl's freewrap code to integrate tkinter into py2xe single executables? We currently use the (fairly clunky) nsis route to create single file executables with py2exe as input, but with the new bundle_files option it should be possible to integrate our tcl/tk stuff into a common library.zip as that seems to be the method used by freewrap. --...
15
2016
by: flyingisfun1217 | last post by:
Hi, I'm too lazy to retype my "problem", so here's the message I sent to the py2exe mailing list (not quite the right place, but thankfully, I was redirected here...) I know that the most known tkinter intro guide at the time is "An Intorduction to Tkinter" by Frederick Lundh, but after trying some of the examples, I noticed that they did not work, and questioned what version of tkinter it was written for. When I saw that it was...
1
2972
by: Kevin Walzer | last post by:
I'm not sure how often members of this list visit the Tkinter wiki at http://tkinter.unpythonic.net/wiki/FrontPage; this wiki seems to have less traffic in general than the Tcl/Tk wiki at http://wiki.tcl.tk. Given that, I hope it's not out of line for me to call attention to several pages that I've posted about integrating Tile (http://tktable.sourceforge.net/tile) and TableList (http://www.nemethi.de, http://wiki.tcl.tk/5527) into...
1
2809
by: maryannj | last post by:
I've got a python GUI working with Tkinter, and I need to package it as an executable file, preferably a single file. I've got py2exe working without the 'bundle_files' option, but when I add that option in ("bundle_files": 1), the built executable gives me the following error: ------------------------------------------------------------------- Fatal Python error: Interpreter not initialized (version mismatch?) This application has...
0
13474
bartonc
by: bartonc | last post by:
You can find the original author of the script by ggling " Py2Exe version 6.3 setup" The cool thing about this is that it calls py2exe, just in case you're uncomfortable with the command line. I had to search hi and lo for the example of how to exclude Tkinter. Coming soon: scipy includes and numpy include that gets rid of complaints of missing modules that are fantom errors. # Py2Exe version 6.3 setup file for wxPython GUI programs. #...
1
2868
by: Alex Bryan | last post by:
I know this is possible so someone out there should be able to help me! Okay, I have a program that uses Tkinter, and BeautifulSoup. I don't think it should be a problem. I want to create an exe of it. I have py2exe but I don't really know how to work it. I read their tutorial thing and did a setup that looked something like this: from distutils.core import setup import py2exe setup(console)
0
9522
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10111
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.