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 3987 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 dialogbox is covered by
the window of the main application and must be "fetched" again via the
taskbar to continue. Is there a way to "force" the dialogbox on top of
all other windows? (I'm using MSWindows and Python22)
The source of my dialogbox-class...
|
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 a
button labeled "ok". The second window is supposed to be modal - it should
not be possible to reset the focus back to the first window or close the
first window without first closing the second. The program works just fine
in Windows XP...
|
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 turn the contents of the 3rd list (call
it states would be updated by a change in the 2nd list. If anyone can share a
recipe or some ideas, I'd be grateful!
Here's some sample code that displays three OptionMenus, but doesn't update the
list...
|
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 coming from a server.
I want to redraw the rectangles every time I press the Again button. This works
for me, but I get an extra set of rectangles each time I press the Again button.
How to get rid of this effect?
Here's the app so you can see...
|
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 things up. After the file dialog, I can no longer use
the Text widget (typing, selecting, it doesn't work anymore!)
What am I doing wrong?
TIA,
--Irmen de Jong
| |
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 Canvas Object.
Perhaps any Tkinter object, didn't get that far.
The problem arises because I have a geometry tutorial
with a progression of drawings and want the students to
be able to go "back". Creating "snapshots" of points
in time in the...
|
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 I am hoping someone knows what I am
doing wrong:
1) Pressing the Settings.. Button multiple times, brings up many instances
of the Settings Panel. I just want it to bring up one. Is there an easy
way to do 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 yesterday), so I am
sure I am overlooking something simple.
The basic idea is that my application will consist of a series of modal
dialogs, that are chained together in "wizard" fashion. There will be
some processing in between dialogs, but for the most...
|
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 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...
|
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...
|
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,...
| |
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |