Hello.
My script run fine within python but not in my program(SDS/2 wich is a software like Autocad). The problem is I got an error when the time comes to read the line14 to 19. (Source code come from Tkinter.py) - class Tk(Misc, Wm):
-
"""Toplevel widget of Tk which represents mostly the main window
-
of an appliation. It has an associated Tcl interpreter."""
-
_w = '.'
-
def __init__(self, screenName=None, baseName=None, className='Tk'):
-
"""Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will
-
be created. BASENAME will be used for the identification of the profile file (see
-
readprofile).
-
It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME
-
is the name of the widget class."""
-
global _default_root
-
self.master = None
-
self.children = {}
-
if baseName is None:
-
import sys, os
-
baseName = os.path.basename(sys.argv[0])
-
baseName, ext = os.path.splitext(baseName)
-
if ext not in ('.py', '.pyc', '.pyo'):
-
baseName = baseName + ext
-
self.tk = _tkinter.create(screenName, baseName, className)
-
self.tk.wantobjects(wantobjects)
-
if _MacOS and hasattr(_MacOS, 'SchedParams'):
-
# Disable event scanning except for Command-Period
-
_MacOS.SchedParams(1, 0)
-
# Work around nasty MacTk bug
-
# XXX Is this one still needed?
-
self.update()
-
# Version sanity checks
-
tk_version = self.tk.getvar('tk_version')
-
if tk_version != _tkinter.TK_VERSION:
-
raise RuntimeError, \
-
"tk.h version (%s) doesn't match libtk.a version (%s)" \
-
% (_tkinter.TK_VERSION, tk_version)
-
# Under unknown circumstances, tcl_version gets coerced to float
-
tcl_version = str(self.tk.getvar('tcl_version'))
-
if tcl_version != _tkinter.TCL_VERSION:
-
raise RuntimeError, \
-
"tcl.h version (%s) doesn't match libtcl.a version (%s)" \
-
% (_tkinter.TCL_VERSION, tcl_version)
-
if TkVersion < 4.0:
-
raise RuntimeError, \
-
"Tk 4.0 or higher is required; found Tk %s" \
-
% str(TkVersion)
-
self.tk.createcommand('tkerror', _tkerror)
-
self.tk.createcommand('exit', _exit)
-
self.readprofile(baseName, className)
-
if _support_default_root and not _default_root:
-
_default_root = self
-
self.protocol("WM_DELETE_WINDOW", self.destroy)
-
def destroy(self):
-
"""Destroy this and all descendants widgets. This will
-
end the application of this Tcl interpreter."""
-
for c in self.children.values(): c.destroy()
-
self.tk.call('destroy', self._w)
-
Misc.destroy(self)
-
global _default_root
-
if _support_default_root and _default_root is self:
-
_default_root = None
-
def readprofile(self, baseName, className):
-
"""Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into
-
the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if
-
such a file exists in the home directory."""
-
import os
-
if os.environ.has_key('HOME'): home = os.environ['HOME']
-
else: home = os.curdir
-
class_tcl = os.path.join(home, '.%s.tcl' % className)
-
class_py = os.path.join(home, '.%s.py' % className)
-
base_tcl = os.path.join(home, '.%s.tcl' % baseName)
-
base_py = os.path.join(home, '.%s.py' % baseName)
-
dir = {'self': self}
-
exec 'from Tkinter import *' in dir
-
if os.path.isfile(class_tcl):
-
self.tk.call('source', class_tcl)
-
if os.path.isfile(class_py):
-
execfile(class_py, dir)
-
if os.path.isfile(base_tcl):
-
self.tk.call('source', base_tcl)
-
if os.path.isfile(base_py):
-
execfile(base_py, dir)
-
def report_callback_exception(self, exc, val, tb):
-
"""Internal function. It reports exception on sys.stderr."""
-
import traceback, sys
-
sys.stderr.write("Exception in Tkinter callback\n")
-
sys.last_type = exc
-
sys.last_value = val
-
sys.last_traceback = tb
-
traceback.print_exception(exc, val, tb)
-
So, I want to be able to provide the baseName variable in these lines of code to override lines below from 14 to 19. - Tkinter(baseName = file_name_path).Label(text=" ").pack()
-
Tkinter(baseName = file_name_path).Label(text="TEST Dialog Box").pack()
-
Tkinter(baseName = file_name_path).Label(text=" ").pack()
-
mainloop()
-
Is it possible to do that?
Thank You
0 3960 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Thomas Nücker |
last post by:
Hi!
I am creating a dialog-box within my application, using tkinter. The
problem is the following: After the dialogbox is started, the main
application window comes again to top and the...
|
by: DoubleM |
last post by:
Hi,
I'm running Python2.3.3c1 on Mandrake 9.1
The following code is designed to bring up a window with a button labeled
"popup". Clicking on the popup buttons triggers a secondary window with...
|
by: Stewart Midwinter |
last post by:
I would like to link the contents of three OptionMenu lists. When I select an
item from the first list (call it continents), the contents of the 2nd list
(call it countries) would update. And in...
|
by: Stewart Midwinter |
last post by:
I've got a Tkinter app that draws three histograms. At this point I am
simulating real data by drawing rectangles whose size is defined by random
numbers; in the future there would be real data...
|
by: Irmen de Jong |
last post by:
Hi,
I'm having trouble with the code below.
It's just a regular Tk text widget in which you can type and
select text as expected, however the call to tkFileDialog.askopenfilename()
seems to screw...
|
by: phil |
last post by:
I posted the following yesterday and got no response
and did some testing simplifying the circumstances
and it appears that deepcopy fails when the object
to be copied contains a reference to a...
|
by: Michael Yanowitz |
last post by:
Hello:
Below I have included a stripped down version of the GUI I am working on.
It contains 2 dialog boxes - one main and one settings. It has the following
problems, probably all related, that...
|
by: dwelch91 |
last post by:
I'm trying unsuccessfully to do something in Tk that I though would be
easy. After Googling this all day, I think I need some help. I am
admittedly very novice with Tk (I started with it...
|
by: msunderwd |
last post by:
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...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
| |