<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ascend4.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MarkJones</id>
	<title>ASCEND - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://ascend4.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MarkJones"/>
	<link rel="alternate" type="text/html" href="https://ascend4.org/Special:Contributions/MarkJones"/>
	<updated>2026-04-28T21:46:03Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://ascend4.org/index.php?title=User:MarkJones&amp;diff=6173</id>
		<title>User:MarkJones</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=User:MarkJones&amp;diff=6173"/>
		<updated>2021-10-27T22:26:53Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pages and files I&#039;ve created and which are on my watchlist:&lt;br /&gt;
&lt;br /&gt;
=== PAGES ===&lt;br /&gt;
&lt;br /&gt;
* [[Group Contribution Methods]]&lt;br /&gt;
* [[Original UNIFAC]]&lt;br /&gt;
* [[Modified UNIFAC (Dortmund)]]&lt;br /&gt;
* [[Predictive Soave-Redlich-Kwong (PSRK)]]&lt;br /&gt;
* [[TkInter wrapper for tcl/tk GUI]]&lt;br /&gt;
&lt;br /&gt;
=== FILES ===&lt;br /&gt;
&lt;br /&gt;
* [[Media:Phi-phi_approach_PSRK.png]]&lt;br /&gt;
&lt;br /&gt;
* [[File:Phi-phi_approach_PSRK.pdf‎]]&lt;br /&gt;
&lt;br /&gt;
* [[Media:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
=== OTHER STUFF ===&lt;br /&gt;
&lt;br /&gt;
Bachelor thesis:&lt;br /&gt;
&amp;quot;Sensitivity of process design to uncertainties in property estimates applied to extractive distillation&amp;quot;; M. Jones, A. Hukkerikar, G. Sin, R. Gani - Danish Technical University (DTU)&lt;br /&gt;
&lt;br /&gt;
Master thesis:&lt;br /&gt;
&amp;quot;Mild hydrodeoxygenation of a lignin model compound over a NiCu/ZrO2 catalyst in the aqueous and organic phase&amp;quot;; M. Jones, K. Raffelt, J. Sauer - Karlsruhe Institute of Technology (KIT)&lt;br /&gt;
&lt;br /&gt;
PhD:&lt;br /&gt;
&amp;quot;Design and optimization of selected oleochemical processes&amp;quot;; M. Jones, B. Sarup, G. Sin - Danish Technical University (DTU)&lt;br /&gt;
http://www.modlife.eu/Fellows/ESR-10&lt;br /&gt;
&lt;br /&gt;
LinkedIn:&lt;br /&gt;
https://linkedin.com/in/mark-nicholas-jones-7730b1b4&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6106</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6106"/>
		<updated>2019-01-28T21:56:51Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)       #in ../../ascend/general/&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)       #in ../../ascend/system/&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)       #in ../../ascend/utilities/&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)      #in ../../ascend/compiler/&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;) #in ../interface/&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK)      %s&#039; % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST)    %s&#039; % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
extern int  Tktable_Init(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void AscTrap(int)&lt;br /&gt;
&lt;br /&gt;
static void  AscCheckEnvironVars(Tcl_Interp*,const char *progname)&lt;br /&gt;
&lt;br /&gt;
static void AscPrintHelpExit(CONST char *)&lt;br /&gt;
&lt;br /&gt;
static int  AscProcessCommandLine(Tcl_Interp*, int, CONST char **)&lt;br /&gt;
&lt;br /&gt;
static int  AscSetStartupFile(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void StdinProc(ClientData, int)&lt;br /&gt;
&lt;br /&gt;
static void InitDebugMalloc(void)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) -&amp;gt; Library.tcl&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Saving_and_restoring_model_state#Wrapping_the_old_Tcl_functionality&lt;br /&gt;
&amp;quot;The old Tcl/C code uses C code to traverse the model tree and output a text file containing essentially a Tcl script that, when run, does the job of reinserting values into the instance tree by looking up identifiers one-by-one using the &#039;qlfdid&#039; routines. This approach to restoring model values is possibly not particular efficient, but does currently work. The hazards of using the Tcl interpreter from within Python are a bit scary, however, and it would be nicer to keep language &#039;cleanness&#039; in the Python code. &amp;quot;&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/ComponentizingAscend#Older_content_from_this_page...&lt;br /&gt;
&amp;quot;Have moved qlfdid stuff into compiler. Not convinced it was really worth it though. -- User:Jpye&amp;quot;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6105</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6105"/>
		<updated>2019-01-28T21:17:00Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)       #in ../../ascend/general/&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)       #in ../../ascend/system/&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)       #in ../../ascend/utilities/&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)      #in ../../ascend/compiler/&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;) #in ../interface/&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK)      %s&#039; % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST)    %s&#039; % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
extern int  Tktable_Init(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void AscTrap(int)&lt;br /&gt;
&lt;br /&gt;
static void  AscCheckEnvironVars(Tcl_Interp*,const char *progname)&lt;br /&gt;
&lt;br /&gt;
static void AscPrintHelpExit(CONST char *)&lt;br /&gt;
&lt;br /&gt;
static int  AscProcessCommandLine(Tcl_Interp*, int, CONST char **)&lt;br /&gt;
&lt;br /&gt;
static int  AscSetStartupFile(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void StdinProc(ClientData, int)&lt;br /&gt;
&lt;br /&gt;
static void InitDebugMalloc(void)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Saving_and_restoring_model_state#Wrapping_the_old_Tcl_functionality&lt;br /&gt;
&amp;quot;The old Tcl/C code uses C code to traverse the model tree and output a text file containing essentially a Tcl script that, when run, does the job of reinserting values into the instance tree by looking up identifiers one-by-one using the &#039;qlfdid&#039; routines. This approach to restoring model values is possibly not particular efficient, but does currently work. The hazards of using the Tcl interpreter from within Python are a bit scary, however, and it would be nicer to keep language &#039;cleanness&#039; in the Python code. &amp;quot;&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/ComponentizingAscend#Older_content_from_this_page...&lt;br /&gt;
&amp;quot;Have moved qlfdid stuff into compiler. Not convinced it was really worth it though. -- User:Jpye&amp;quot;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6104</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6104"/>
		<updated>2019-01-28T21:13:42Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)       #in ../../ascend/general/&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)       #in ../../ascend/system/&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)       #in ../../ascend/utilities/&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)      #in ../../ascend/compiler/&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;) #in ../interface/&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK)      %s&#039; % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST)    %s&#039; % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
extern int  Tktable_Init(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void AscTrap(int)&lt;br /&gt;
&lt;br /&gt;
static void  AscCheckEnvironVars(Tcl_Interp*,const char *progname)&lt;br /&gt;
&lt;br /&gt;
static void AscPrintHelpExit(CONST char *)&lt;br /&gt;
&lt;br /&gt;
static int  AscProcessCommandLine(Tcl_Interp*, int, CONST char **)&lt;br /&gt;
&lt;br /&gt;
static int  AscSetStartupFile(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void StdinProc(ClientData, int)&lt;br /&gt;
&lt;br /&gt;
static void InitDebugMalloc(void)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
Maybe the procedure has been removed, see: http://ascend4.org/ComponentizingAscend#Older_content_from_this_page...&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Saving_and_restoring_model_state#Wrapping_the_old_Tcl_functionality&lt;br /&gt;
&amp;quot;The old Tcl/C code uses C code to traverse the model tree and output a text file containing essentially a Tcl script that, when run, does the job of reinserting values into the instance tree by looking up identifiers one-by-one using the &#039;qlfdid&#039; routines. This approach to restoring model values is possibly not particular efficient, but does currently work. The hazards of using the Tcl interpreter from within Python are a bit scary, however, and it would be nicer to keep language &#039;cleanness&#039; in the Python code. &amp;quot;&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/ComponentizingAscend#Older_content_from_this_page...&lt;br /&gt;
&amp;quot;Have moved qlfdid stuff into compiler. Not convinced it was really worth it though. -- User:Jpye&amp;quot;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6103</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6103"/>
		<updated>2019-01-28T21:07:43Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)       #in ../../ascend/general/&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)       #in ../../ascend/system/&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)       #in ../../ascend/utilities/&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)      #in ../../ascend/compiler/&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;) #in ../interface/&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK)      %s&#039; % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST)    %s&#039; % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
extern int  Tktable_Init(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void AscTrap(int)&lt;br /&gt;
&lt;br /&gt;
static void  AscCheckEnvironVars(Tcl_Interp*,const char *progname)&lt;br /&gt;
&lt;br /&gt;
static void AscPrintHelpExit(CONST char *)&lt;br /&gt;
&lt;br /&gt;
static int  AscProcessCommandLine(Tcl_Interp*, int, CONST char **)&lt;br /&gt;
&lt;br /&gt;
static int  AscSetStartupFile(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void StdinProc(ClientData, int)&lt;br /&gt;
&lt;br /&gt;
static void InitDebugMalloc(void)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
Maybe the procedure has been removed, see: http://ascend4.org/ComponentizingAscend#Older_content_from_this_page...&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Saving_and_restoring_model_state#Wrapping_the_old_Tcl_functionality&lt;br /&gt;
&amp;quot;The old Tcl/C code uses C code to traverse the model tree and output a text file containing essentially a Tcl script that, when run, does the job of reinserting values into the instance tree by looking up identifiers one-by-one using the &#039;qlfdid&#039; routines. This approach to restoring model values is possibly not particular efficient, but does currently work. The hazards of using the Tcl interpreter from within Python are a bit scary, however, and it would be nicer to keep language &#039;cleanness&#039; in the Python code. &amp;quot;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6102</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6102"/>
		<updated>2019-01-28T21:02:38Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)       #in ../../ascend/general/&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)       #in ../../ascend/system/&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)       #in ../../ascend/utilities/&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)      #in ../../ascend/compiler/&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;) #in ../interface/&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK)      %s&#039; % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST)    %s&#039; % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
extern int  Tktable_Init(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void AscTrap(int)&lt;br /&gt;
&lt;br /&gt;
static void  AscCheckEnvironVars(Tcl_Interp*,const char *progname)&lt;br /&gt;
&lt;br /&gt;
static void AscPrintHelpExit(CONST char *)&lt;br /&gt;
&lt;br /&gt;
static int  AscProcessCommandLine(Tcl_Interp*, int, CONST char **)&lt;br /&gt;
&lt;br /&gt;
static int  AscSetStartupFile(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void StdinProc(ClientData, int)&lt;br /&gt;
&lt;br /&gt;
static void InitDebugMalloc(void)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
Maybe the procedure has been removed, see: http://ascend4.org/ComponentizingAscend#Older_content_from_this_page...&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Saving_and_restoring_model_state#Wrapping_the_old_Tcl_functionality&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6101</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6101"/>
		<updated>2019-01-28T20:48:21Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)       #in ../../ascend/general/&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)       #in ../../ascend/system/&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)       #in ../../ascend/utilities/&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)      #in ../../ascend/compiler/&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;) #in ../interface/&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK)      %s&#039; % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST)    %s&#039; % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
extern int  Tktable_Init(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void AscTrap(int)&lt;br /&gt;
&lt;br /&gt;
static void  AscCheckEnvironVars(Tcl_Interp*,const char *progname)&lt;br /&gt;
&lt;br /&gt;
static void AscPrintHelpExit(CONST char *)&lt;br /&gt;
&lt;br /&gt;
static int  AscProcessCommandLine(Tcl_Interp*, int, CONST char **)&lt;br /&gt;
&lt;br /&gt;
static int  AscSetStartupFile(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void StdinProc(ClientData, int)&lt;br /&gt;
&lt;br /&gt;
static void InitDebugMalloc(void)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
Maybe the procedure has been removed, see: http://ascend4.org/ComponentizingAscend#Older_content_from_this_page...&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6100</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6100"/>
		<updated>2019-01-28T20:46:59Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)       #in ../../ascend/general/&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)       #in ../../ascend/system/&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)       #in ../../ascend/utilities/&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)      #in ../../ascend/compiler/&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;) #in ../interface/&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK)      %s&#039; % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST)    %s&#039; % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
extern int  Tktable_Init(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void AscTrap(int)&lt;br /&gt;
&lt;br /&gt;
static void  AscCheckEnvironVars(Tcl_Interp*,const char *progname)&lt;br /&gt;
&lt;br /&gt;
static void AscPrintHelpExit(CONST char *)&lt;br /&gt;
&lt;br /&gt;
static int  AscProcessCommandLine(Tcl_Interp*, int, CONST char **)&lt;br /&gt;
&lt;br /&gt;
static int  AscSetStartupFile(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void StdinProc(ClientData, int)&lt;br /&gt;
&lt;br /&gt;
static void InitDebugMalloc(void)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
Maybe the procedure has been removed, see: http://ascend4.org/ComponentizingAscend&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6099</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6099"/>
		<updated>2019-01-28T20:14:22Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Python script to wrap the legacy tcl code with TkInter */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)       #in ../../ascend/general/&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)       #in ../../ascend/system/&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)       #in ../../ascend/utilities/&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)      #in ../../ascend/compiler/&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;) #in ../interface/&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK)      %s&#039; % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST)    %s&#039; % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
extern int  Tktable_Init(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void AscTrap(int)&lt;br /&gt;
&lt;br /&gt;
static void  AscCheckEnvironVars(Tcl_Interp*,const char *progname)&lt;br /&gt;
&lt;br /&gt;
static void AscPrintHelpExit(CONST char *)&lt;br /&gt;
&lt;br /&gt;
static int  AscProcessCommandLine(Tcl_Interp*, int, CONST char **)&lt;br /&gt;
&lt;br /&gt;
static int  AscSetStartupFile(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void StdinProc(ClientData, int)&lt;br /&gt;
&lt;br /&gt;
static void InitDebugMalloc(void)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6098</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6098"/>
		<updated>2019-01-28T19:55:41Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
extern int  Tktable_Init(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void AscTrap(int)&lt;br /&gt;
&lt;br /&gt;
static void  AscCheckEnvironVars(Tcl_Interp*,const char *progname)&lt;br /&gt;
&lt;br /&gt;
static void AscPrintHelpExit(CONST char *)&lt;br /&gt;
&lt;br /&gt;
static int  AscProcessCommandLine(Tcl_Interp*, int, CONST char **)&lt;br /&gt;
&lt;br /&gt;
static int  AscSetStartupFile(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void StdinProc(ClientData, int)&lt;br /&gt;
&lt;br /&gt;
static void InitDebugMalloc(void)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6097</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6097"/>
		<updated>2019-01-27T12:15:55Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* ascend/tcltk/interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
extern int  Tktable_Init(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void AscTrap(int)&lt;br /&gt;
&lt;br /&gt;
static void  AscCheckEnvironVars(Tcl_Interp*,const char *progname)&lt;br /&gt;
&lt;br /&gt;
static void AscPrintHelpExit(CONST char *)&lt;br /&gt;
&lt;br /&gt;
static int  AscProcessCommandLine(Tcl_Interp*, int, CONST char **)&lt;br /&gt;
&lt;br /&gt;
static int  AscSetStartupFile(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void StdinProc(ClientData, int)&lt;br /&gt;
&lt;br /&gt;
static void InitDebugMalloc(void)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6096</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6096"/>
		<updated>2019-01-27T12:11:55Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* ascend/tcltk/interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
extern int  Tktable_Init(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void AscTrap(int)&lt;br /&gt;
&lt;br /&gt;
static void  AscCheckEnvironVars(Tcl_Interp*,const char *progname)&lt;br /&gt;
&lt;br /&gt;
static void AscPrintHelpExit(CONST char *)&lt;br /&gt;
&lt;br /&gt;
static int  AscProcessCommandLine(Tcl_Interp*, int, CONST char **)&lt;br /&gt;
&lt;br /&gt;
static int  AscSetStartupFile(Tcl_Interp*)&lt;br /&gt;
&lt;br /&gt;
static void StdinProc(ClientData, int)&lt;br /&gt;
&lt;br /&gt;
static void InitDebugMalloc(void)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6095</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6095"/>
		<updated>2019-01-27T12:09:57Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* ascend/tcltk/interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, CONST char *argv[])&lt;br /&gt;
&lt;br /&gt;
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,&lt;br /&gt;
                     LPSTR lpszCmdLine, int nCmdShow)&lt;br /&gt;
&lt;br /&gt;
static void setargv(int *argcPtr, char ***argvPtr)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
void Asc_AddCommand(Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,&lt;br /&gt;
                    ClientData cdata, Tcl_CmdDeleteProc *deleteProc,&lt;br /&gt;
                    CONST char *group, CONST char *usage,&lt;br /&gt;
                    CONST char *shorth, HLFunc longh)&lt;br /&gt;
&lt;br /&gt;
void Asc_CreateCommands(Tcl_Interp *interp)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6094</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6094"/>
		<updated>2019-01-27T11:50:24Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* ascend/tcltk/tk/ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env tcl_platform&lt;br /&gt;
global asc_swap_del_backspace&lt;br /&gt;
&lt;br /&gt;
proc user_shutdown&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global ascSourceVect errorInfo&lt;br /&gt;
global tcl_platform tk_version&lt;br /&gt;
global ascGlobalVect&lt;br /&gt;
&lt;br /&gt;
proc AscGnuButton&lt;br /&gt;
proc Help&lt;br /&gt;
proc asc_source&lt;br /&gt;
proc trace_var&lt;br /&gt;
proc trace_log&lt;br /&gt;
proc load_Templates&lt;br /&gt;
proc mcgraw_notice&lt;br /&gt;
proc balloon_notice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
proc ascsetdebug&lt;br /&gt;
proc asc_catch&lt;br /&gt;
proc awin&lt;br /&gt;
proc asc_fixiconnames&lt;br /&gt;
proc Redraw&lt;br /&gt;
proc set_cmuBindings&lt;br /&gt;
proc asctk_textCut&lt;br /&gt;
proc asctk_textCopy&lt;br /&gt;
proc asctk_textPaste&lt;br /&gt;
proc asc_export_selection&lt;br /&gt;
proc set_Global_Defaults&lt;br /&gt;
proc set_Template_defaults&lt;br /&gt;
proc Glob_do_GNU&lt;br /&gt;
proc ascShowInfo&lt;br /&gt;
proc Global_Dismiss_Forever&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global ascViewWindowVect&lt;br /&gt;
&lt;br /&gt;
proc setpos&lt;br /&gt;
proc getpos&lt;br /&gt;
proc sanegeometry&lt;br /&gt;
proc osgpos&lt;br /&gt;
proc ospos&lt;br /&gt;
proc gospos&lt;br /&gt;
proc Browser&lt;br /&gt;
proc Debugger&lt;br /&gt;
proc Display&lt;br /&gt;
proc Global&lt;br /&gt;
proc Library&lt;br /&gt;
proc Matrix&lt;br /&gt;
proc Probe&lt;br /&gt;
proc Script&lt;br /&gt;
proc Simulations&lt;br /&gt;
proc Solver&lt;br /&gt;
proc SolverGeneral&lt;br /&gt;
proc Toolbox&lt;br /&gt;
proc Units&lt;br /&gt;
proc AscPlot&lt;br /&gt;
proc Environment&lt;br /&gt;
proc Set_ViewVect_Values&lt;br /&gt;
proc Set_View_Option_Values&lt;br /&gt;
proc View_Options&lt;br /&gt;
proc View_Appearance&lt;br /&gt;
proc View_Get_Proc_Name&lt;br /&gt;
proc View_Save_Values&lt;br /&gt;
proc View_InitDialog&lt;br /&gt;
proc View_WindowInitDialog&lt;br /&gt;
proc View_Set_Save_Options&lt;br /&gt;
proc View_Save_Window_Appearance&lt;br /&gt;
proc View_Save_Window_Options&lt;br /&gt;
proc View_Save_SpecialWindow_Values&lt;br /&gt;
proc View_Save_Windows_Values&lt;br /&gt;
proc View_Save_Interface_Values&lt;br /&gt;
proc View_Save_Solver_Params&lt;br /&gt;
proc View_Save_Solvers_Params&lt;br /&gt;
proc View_Source_Option_Files&lt;br /&gt;
proc View_Source_Params_Files&lt;br /&gt;
proc View_Help&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
global env&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfLoadInfo&lt;br /&gt;
global tcl_platform&lt;br /&gt;
global argc&lt;br /&gt;
global argv&lt;br /&gt;
global auto_path&lt;br /&gt;
global xfLoadPath&lt;br /&gt;
global xfShowWindow.browser&lt;br /&gt;
global xfShowWindow.display&lt;br /&gt;
global xfShowWindow.library&lt;br /&gt;
global xfShowWindow.probe&lt;br /&gt;
global xfShowWindow.script&lt;br /&gt;
global xfShowWindow.sims&lt;br /&gt;
global xfShowWindow.solver&lt;br /&gt;
global xfShowWindow.toolbox&lt;br /&gt;
global xfShowWindow.util&lt;br /&gt;
global xfShowWindow.units&lt;br /&gt;
&lt;br /&gt;
proc ShowWindow.&lt;br /&gt;
proc StartupSrc.&lt;br /&gt;
proc EndSrc.&lt;br /&gt;
proc XFLocalIncludeModule&lt;br /&gt;
proc XFLocalParseAppDefs&lt;br /&gt;
proc XFLocalLoadAppDefs&lt;br /&gt;
proc XFLocalSetAppDefs&lt;br /&gt;
proc InitGlobals&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6093</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6093"/>
		<updated>2019-01-27T11:24:19Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://matplotlib.org/gallery/user_interfaces/embedding_in_tk_sgskip.html&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6092</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6092"/>
		<updated>2018-12-31T01:12:26Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
[[File:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=User:MarkJones&amp;diff=6091</id>
		<title>User:MarkJones</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=User:MarkJones&amp;diff=6091"/>
		<updated>2018-12-31T01:11:35Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* FILES */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pages and files I&#039;ve created and which are on my watchlist:&lt;br /&gt;
&lt;br /&gt;
=== PAGES ===&lt;br /&gt;
&lt;br /&gt;
* [[Group Contribution Methods]]&lt;br /&gt;
* [[Original UNIFAC]]&lt;br /&gt;
* [[Modified UNIFAC (Dortmund)]]&lt;br /&gt;
* [[Predictive Soave-Redlich-Kwong (PSRK)]]&lt;br /&gt;
* [[TkInter wrapper for tcl/tk GUI]]&lt;br /&gt;
&lt;br /&gt;
=== FILES ===&lt;br /&gt;
&lt;br /&gt;
* [[Media:Phi-phi_approach_PSRK.png]]&lt;br /&gt;
&lt;br /&gt;
* [[File:Phi-phi_approach_PSRK.pdf‎]]&lt;br /&gt;
&lt;br /&gt;
* [[Media:ascend_tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
=== OTHER STUFF ===&lt;br /&gt;
&lt;br /&gt;
Bachelor thesis:&lt;br /&gt;
&amp;quot;Sensitivity of process design to uncertainties in property estimates applied to extractive distillation&amp;quot;; M. Jones, A. Hukkerikar, G. Sin, R. Gani - Danish Technical University (DTU)&lt;br /&gt;
&lt;br /&gt;
Master thesis:&lt;br /&gt;
&amp;quot;Mild hydrodeoxygenation of a lignin model compound over a NiCu/ZrO2 catalyst in the aqueous and organic phase&amp;quot;; M. Jones, K. Raffelt, J. Sauer - Karlsruhe Institute of Technology (KIT)&lt;br /&gt;
&lt;br /&gt;
PhD:&lt;br /&gt;
&amp;quot;Design and optimization of selected oleochemical processes&amp;quot;; M. Jones, B. Sarup, G. Sin - Danish Technical University (DTU)&lt;br /&gt;
http://www.modlife.eu/Fellows/ESR-10&lt;br /&gt;
&lt;br /&gt;
LinkedIn:&lt;br /&gt;
https://dk.linkedin.com/in/mark-jones-7730b1b4&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=File:Ascend_tcltk_GUI.png&amp;diff=6090</id>
		<title>File:Ascend tcltk GUI.png</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=File:Ascend_tcltk_GUI.png&amp;diff=6090"/>
		<updated>2018-12-31T01:07:45Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=User:MarkJones&amp;diff=6089</id>
		<title>User:MarkJones</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=User:MarkJones&amp;diff=6089"/>
		<updated>2018-12-31T01:06:44Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* FILES */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pages and files I&#039;ve created and which are on my watchlist:&lt;br /&gt;
&lt;br /&gt;
=== PAGES ===&lt;br /&gt;
&lt;br /&gt;
* [[Group Contribution Methods]]&lt;br /&gt;
* [[Original UNIFAC]]&lt;br /&gt;
* [[Modified UNIFAC (Dortmund)]]&lt;br /&gt;
* [[Predictive Soave-Redlich-Kwong (PSRK)]]&lt;br /&gt;
* [[TkInter wrapper for tcl/tk GUI]]&lt;br /&gt;
&lt;br /&gt;
=== FILES ===&lt;br /&gt;
&lt;br /&gt;
* [[Media:Phi-phi_approach_PSRK.png]]&lt;br /&gt;
&lt;br /&gt;
* [[File:Phi-phi_approach_PSRK.pdf‎]]&lt;br /&gt;
&lt;br /&gt;
* [[Media:tcltk_GUI.png]]&lt;br /&gt;
&lt;br /&gt;
=== OTHER STUFF ===&lt;br /&gt;
&lt;br /&gt;
Bachelor thesis:&lt;br /&gt;
&amp;quot;Sensitivity of process design to uncertainties in property estimates applied to extractive distillation&amp;quot;; M. Jones, A. Hukkerikar, G. Sin, R. Gani - Danish Technical University (DTU)&lt;br /&gt;
&lt;br /&gt;
Master thesis:&lt;br /&gt;
&amp;quot;Mild hydrodeoxygenation of a lignin model compound over a NiCu/ZrO2 catalyst in the aqueous and organic phase&amp;quot;; M. Jones, K. Raffelt, J. Sauer - Karlsruhe Institute of Technology (KIT)&lt;br /&gt;
&lt;br /&gt;
PhD:&lt;br /&gt;
&amp;quot;Design and optimization of selected oleochemical processes&amp;quot;; M. Jones, B. Sarup, G. Sin - Danish Technical University (DTU)&lt;br /&gt;
http://www.modlife.eu/Fellows/ESR-10&lt;br /&gt;
&lt;br /&gt;
LinkedIn:&lt;br /&gt;
https://dk.linkedin.com/in/mark-jones-7730b1b4&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6088</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6088"/>
		<updated>2018-12-28T01:18:13Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
$ grep -Ril Color_Init *&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6087</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6087"/>
		<updated>2018-12-28T01:17:53Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;br /&gt;
&lt;br /&gt;
Searching through the whole trunk branch gives no results:&lt;br /&gt;
&lt;br /&gt;
grep -Ril Color_Init *&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6086</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6086"/>
		<updated>2018-12-28T01:01:27Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;br /&gt;
&lt;br /&gt;
Stuck with &amp;quot;couldn&#039;t find procedure Color_Init&amp;quot;. And I can&#039;t find it myself in which file this procedure ought to be.&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6085</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6085"/>
		<updated>2018-12-28T00:57:08Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require) and see the Notes section below what to change in the codebase.&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6084</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6084"/>
		<updated>2018-12-28T00:55:11Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Python script to wrap the legacy tcl code with TkInter */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require).&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5 &lt;br /&gt;
&lt;br /&gt;
Create pkgIndex.tcl (case-sensitive!) in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
package ifneeded LibraryProc 1.0 \&lt;br /&gt;
    [list load [file join $dir LibraryProc[info sharedlibextension]]]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6083</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6083"/>
		<updated>2018-12-28T00:52:02Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Python script to wrap the legacy tcl code with TkInter */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The GUI starts if one comments all the lines loading the packages out (package require).&lt;br /&gt;
&lt;br /&gt;
Shared libraries can be compiled and then provided as a package via pkgIndex.tcl in the respective folder for the shared libraries.&lt;br /&gt;
&lt;br /&gt;
Example for ascend/tcltk/interface/LibraryProc.c:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;tcl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6082</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6082"/>
		<updated>2018-12-28T00:46:07Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Python script to wrap the legacy tcl code with TkInter */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar()&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../interface&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/compiler&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/general&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/system&#039;)&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;../../ascend/utilities&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;package require color 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require block 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require error 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require module 1.0&#039;)&lt;br /&gt;
gui.tk.eval(&#039;package require LibraryProc 1.0&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6081</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6081"/>
		<updated>2018-12-27T23:39:46Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
Recursively going through all files where a symbol is defined on which the previous generated shared library depends on and make a shared library of it and package it via pkgIndex.tcl in the respective folder.&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6080</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6080"/>
		<updated>2018-12-27T22:27:39Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6079</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6079"/>
		<updated>2018-12-27T22:20:58Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;br /&gt;
&lt;br /&gt;
add -c option to compilation:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -c -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
now: couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: only ET_DYN and ET_EXEC can be loaded&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6078</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6078"/>
		<updated>2018-12-27T22:04:17Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/compiler/module.h&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6077</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6077"/>
		<updated>2018-12-27T22:02:02Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;br /&gt;
&lt;br /&gt;
ASC_DLLSPEC CONST char* g_alt_ending[MOD_FILE_EXTS]&lt;br /&gt;
&lt;br /&gt;
This array defines the expected file extensions for parsable ascend MODEL/ATOM/unit code. Files are not limited to these, however. Interfaces that see a trailing .* where * is other than these should enquire as to the user intent: the user may have made a mistake.&lt;br /&gt;
&lt;br /&gt;
Definition at line 58 of file ascend/module/compiler/module.h&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6076</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6076"/>
		<updated>2018-12-27T21:53:59Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
$tclsh&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6075</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6075"/>
		<updated>2018-12-27T21:09:55Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
$ gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
% load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
% couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6074</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6074"/>
		<updated>2018-12-27T21:05:02Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library (extension). See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6073</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6073"/>
		<updated>2018-12-27T21:03:27Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library. See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
from https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
 Enabling the stubs mechanism for an extension requires the following steps:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
    Call Tcl_InitStubs in the extension before calling any other Tcl functions.&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
    Define the USE_TCL_STUBS symbol. Typically, you would include the -DUSE_TCL_STUBS flag when compiling the extension.&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
    Link the extension with the Tcl stubs library instead of the standard Tcl library. On Unix platforms, the library name is libtclstub8.4.a; on Windows platforms, the library name is tclstub84.lib.&lt;br /&gt;
&lt;br /&gt;
If the extension also requires the Tk API, it must also call Tk_InitStubs to initialize the Tk stubs interface and link with the Tk stubs libraries. See the Tk_InitStubs page for more information. &lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;br /&gt;
&lt;br /&gt;
So the global variable g_alt_ending can&#039;t be found:&lt;br /&gt;
&lt;br /&gt;
http://ascend4.org/Global_variables&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6072</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6072"/>
		<updated>2018-12-27T20:59:52Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library. See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
from https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
 Enabling the stubs mechanism for an extension requires the following steps:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
    Call Tcl_InitStubs in the extension before calling any other Tcl functions.&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
    Define the USE_TCL_STUBS symbol. Typically, you would include the -DUSE_TCL_STUBS flag when compiling the extension.&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
    Link the extension with the Tcl stubs library instead of the standard Tcl library. On Unix platforms, the library name is libtclstub8.4.a; on Windows platforms, the library name is tclstub84.lib.&lt;br /&gt;
&lt;br /&gt;
If the extension also requires the Tk API, it must also call Tk_InitStubs to initialize the Tk stubs interface and link with the Tk stubs libraries. See the Tk_InitStubs page for more information. &lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
But getting this error then when trying to load the shared library in the tcl shell (tclsh):&lt;br /&gt;
&lt;br /&gt;
load LibraryProc.so&lt;br /&gt;
&lt;br /&gt;
couldn&#039;t load file &amp;quot;LibraryProc.so&amp;quot;: LibraryProc.so: undefined symbol: g_alt_ending&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6071</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6071"/>
		<updated>2018-12-27T20:56:37Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library. See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
from https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
 Enabling the stubs mechanism for an extension requires the following steps:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
    Call Tcl_InitStubs in the extension before calling any other Tcl functions.&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
    Define the USE_TCL_STUBS symbol. Typically, you would include the -DUSE_TCL_STUBS flag when compiling the extension.&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
    Link the extension with the Tcl stubs library instead of the standard Tcl library. On Unix platforms, the library name is libtclstub8.4.a; on Windows platforms, the library name is tclstub84.lib.&lt;br /&gt;
&lt;br /&gt;
If the extension also requires the Tk API, it must also call Tk_InitStubs to initialize the Tk stubs interface and link with the Tk stubs libraries. See the Tk_InitStubs page for more information. &lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
gcc -fPIC -shared -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ -o LibraryProc.so LibraryProc.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6070</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6070"/>
		<updated>2018-12-27T10:53:15Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library. See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
from https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
 Enabling the stubs mechanism for an extension requires the following steps:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
    Call Tcl_InitStubs in the extension before calling any other Tcl functions.&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
    Define the USE_TCL_STUBS symbol. Typically, you would include the -DUSE_TCL_STUBS flag when compiling the extension.&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
    Link the extension with the Tcl stubs library instead of the standard Tcl library. On Unix platforms, the library name is libtclstub8.4.a; on Windows platforms, the library name is tclstub84.lib.&lt;br /&gt;
&lt;br /&gt;
If the extension also requires the Tk API, it must also call Tk_InitStubs to initialize the Tk stubs interface and link with the Tk stubs libraries. See the Tk_InitStubs page for more information. &lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries:&lt;br /&gt;
&lt;br /&gt;
gcc -shared -o *.so -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ *.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6069</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6069"/>
		<updated>2018-12-27T10:28:41Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library. See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
from https://www.tcl.tk/man/tcl8.4/TclLib/InitStubs.htm:&lt;br /&gt;
&lt;br /&gt;
 Enabling the stubs mechanism for an extension requires the following steps:&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
    Call Tcl_InitStubs in the extension before calling any other Tcl functions.&lt;br /&gt;
&lt;br /&gt;
2)&lt;br /&gt;
    Define the USE_TCL_STUBS symbol. Typically, you would include the -DUSE_TCL_STUBS flag when compiling the extension.&lt;br /&gt;
&lt;br /&gt;
3)&lt;br /&gt;
    Link the extension with the Tcl stubs library instead of the standard Tcl library. On Unix platforms, the library name is libtclstub8.4.a; on Windows platforms, the library name is tclstub84.lib.&lt;br /&gt;
&lt;br /&gt;
If the extension also requires the Tk API, it must also call Tk_InitStubs to initialize the Tk stubs interface and link with the Tk stubs libraries. See the Tk_InitStubs page for more information. &lt;br /&gt;
&lt;br /&gt;
see also: https://www.tcl.tk/doc/howto/stubs.html&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries (still getting errors):&lt;br /&gt;
&lt;br /&gt;
gcc -shared -o *.so -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ *.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6068</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6068"/>
		<updated>2018-12-27T10:13:40Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library. See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
Change to interface directory and compile to shared libraries (still getting errors):&lt;br /&gt;
&lt;br /&gt;
gcc -shared -o *.so -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ -I ../../ *.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
doesn&#039;t work because: In file included from tcltk/interface/AscBitmaps.c:31:0:&lt;br /&gt;
tcltk/interface/config.h:30:37: fatal error: ascend/general/platform.h: No such file or directory&lt;br /&gt;
compilation terminated.&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6067</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6067"/>
		<updated>2018-12-27T01:27:27Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled as a shared library. See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;br /&gt;
&lt;br /&gt;
gcc -shared -o tcltk/interface/*.so -DUSE_TCL_STUBS -I /usr/include/tcl8.5/ tcltk/interface/*.c -L /usr/share/tcltk/tcl8.5 -ltclstub8.5&lt;br /&gt;
&lt;br /&gt;
doesn&#039;t work because: In file included from tcltk/interface/AscBitmaps.c:31:0:&lt;br /&gt;
tcltk/interface/config.h:30:37: fatal error: ascend/general/platform.h: No such file or directory&lt;br /&gt;
compilation terminated.&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6066</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6066"/>
		<updated>2018-12-26T23:59:19Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND which is part of engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled. See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6065</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6065"/>
		<updated>2018-12-26T23:47:59Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND. This is engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;br /&gt;
&lt;br /&gt;
The commands aren&#039;t found because the C code isn&#039;t compiled. See this link to build the extensions in ascend/tcltk/interface:&lt;br /&gt;
&lt;br /&gt;
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6064</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6064"/>
		<updated>2018-12-26T23:07:06Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND. This is engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0 (done in Python script)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
copy both files from Python3 branch into the trunk branch folder&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6063</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6063"/>
		<updated>2018-12-26T23:04:59Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND. This is engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also:&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
https://github.com/nbro/tktable/issues/1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6062</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6062"/>
		<updated>2018-12-26T23:00:02Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND. This is engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also: https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT???:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ASCENDTK:&lt;br /&gt;
&lt;br /&gt;
This environment variable is used to define the location of the Tcl/Tk support files&lt;br /&gt;
used by the ASCEND Tcl/Tk GUI. It defaults to $ASCENDDIST/TK. It has no effect on the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6061</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6061"/>
		<updated>2018-12-26T22:44:03Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND. This is engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also: https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT???:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ASCENDTK:&lt;br /&gt;
&lt;br /&gt;
This environment variable is used to define the location of the Tcl/Tk support files&lt;br /&gt;
used by the ASCEND Tcl/Tk GUI. It defaults to $ASCENDDIST/TK. It has no effect on the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl) defined in LibraryProc.h&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6060</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6060"/>
		<updated>2018-12-26T22:37:30Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND. This is engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also: https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT???:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ASCENDTK:&lt;br /&gt;
&lt;br /&gt;
This environment variable is used to define the location of the Tcl/Tk support files&lt;br /&gt;
used by the ASCEND Tcl/Tk GUI. It defaults to $ASCENDDIST/TK. It has no effect on the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6059</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6059"/>
		<updated>2018-12-26T22:36:39Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND. This is computers and chemical engineering history and worth conserving.&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also: https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT???:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ASCENDTK:&lt;br /&gt;
&lt;br /&gt;
This environment variable is used to define the location of the Tcl/Tk support files&lt;br /&gt;
used by the ASCEND Tcl/Tk GUI. It defaults to $ASCENDDIST/TK. It has no effect on the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6058</id>
		<title>TkInter wrapper for tcl/tk GUI</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=TkInter_wrapper_for_tcl/tk_GUI&amp;diff=6058"/>
		<updated>2018-12-26T21:22:23Z</updated>

		<summary type="html">&lt;p&gt;MarkJones: /* Python script to wrap the legacy tcl code with TkInter */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide how you can check out the oldschool 90s tcl/tk interface of ASCEND. This is computers and chemical engineering history and worth conserving!&lt;br /&gt;
&lt;br /&gt;
The TkInter wrapper is used to call the tcl legacy code:&lt;br /&gt;
&lt;br /&gt;
https://wiki.python.org/moin/TkInter&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Tkinter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are notes which are going to be formulated in detail over time:&lt;br /&gt;
&lt;br /&gt;
=== Python script to wrap the legacy tcl code with TkInter ===&lt;br /&gt;
&lt;br /&gt;
Environment variables have to be set in the Python script.&lt;br /&gt;
&lt;br /&gt;
See http://ascend4.org/Environment_variables_for_ASCEND for more information.&lt;br /&gt;
&lt;br /&gt;
Locate the following script in the ascend/tcltk/tk/ folder and call it from the command line.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import tkinter&lt;br /&gt;
&lt;br /&gt;
gui = tkinter.Tk()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Variables&lt;br /&gt;
ASCENDTK = tkinter.StringVar()&lt;br /&gt;
ASCENDTK.set(&amp;quot;./&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDBITMAPS = tkinter.StringVar()&lt;br /&gt;
ASCENDBITMAPS.set(&amp;quot;./bitmaps&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
ASCENDDIST = tkinter.StringVar()&lt;br /&gt;
ASCENDDIST.set(&amp;quot;../../&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
TKTABLE_LIBRARY = tkinter.StringVar() #the Tktable issue hasn&#039;t been resolved yet&lt;br /&gt;
TKTABLE_LIBRARY.set(&amp;quot;/usr/lib/tcltk/x86_64-linux-gnu/Tktable2.10&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace = tkinter.StringVar()&lt;br /&gt;
asc_swap_del_backspace.set(&amp;quot;1&amp;quot;) # for UNIX systems&lt;br /&gt;
&lt;br /&gt;
argc = tkinter.IntVar()&lt;br /&gt;
argc.set(0)&lt;br /&gt;
&lt;br /&gt;
#Evaluation&lt;br /&gt;
gui.tk.eval(&#039;lappend auto_path {%s}&#039; % &#039;./&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDTK) %s&#039;      % (ASCENDTK.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDBITMAPS) %s&#039; % (ASCENDBITMAPS.get()))&lt;br /&gt;
gui.tk.eval(&#039;set env(ASCENDDIST) %s&#039;    % (ASCENDDIST.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set asc_swap_del_backspace %s&#039; % (asc_swap_del_backspace.get()))&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;set argc %s&#039; % (argc.get()))&lt;br /&gt;
&lt;br /&gt;
#gui.tk.eval(&#039;package require Tktable&#039;)&lt;br /&gt;
&lt;br /&gt;
gui.tk.eval(&#039;source {ascend.tcl}&#039;)&lt;br /&gt;
&lt;br /&gt;
#Mainloop&lt;br /&gt;
gui.mainloop()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/tk/ ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | AscendRC&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | ascend.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
env(ASCENDTK)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | GlobalProc.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
set_global_defaults&lt;br /&gt;
	Glob_do_GNU&lt;br /&gt;
	set_Template_defaults&lt;br /&gt;
	asc_swap_del_backspace -&amp;gt; GlobalProc.tcl ; set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
        set_Global_Defaults {} {&lt;br /&gt;
            __userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | View.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.tcl&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;tcl&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
load_Templates&lt;br /&gt;
Util_do_Read&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ascend/tcltk/interface ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;infobox wikitable&amp;quot; style=&amp;quot;margin-left:1em;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | config.h&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | main.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#ffcfcf;&amp;quot;&amp;gt;&lt;br /&gt;
main()&lt;br /&gt;
&lt;br /&gt;
	This function creates a Tcl interpreter, initializes Tcl and Tk,&lt;br /&gt;
	initializes the Ascend data structures, sets up the user&#039;s&lt;br /&gt;
	environment, sources ASCEND&#039;s startup script, and calls Tk_MainLoop&lt;br /&gt;
	so the user can interact with ASCEND. Cleans up and exits the&lt;br /&gt;
	program when Tk_MainLoop returns.&lt;br /&gt;
&lt;br /&gt;
	This function is based on the functions Tk_Main and Tcl_AppInit&lt;br /&gt;
	from the Tk8.0 distribution.  See the files tkMain.c and tkAppInit.c&lt;br /&gt;
	in the Tk sources.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Commands.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
__userdata_init&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background:#bfffbf;&amp;quot; | Driver.c&lt;br /&gt;
| &amp;lt;source lang=&amp;quot;c&amp;quot; style=&amp;quot;margin:0px; background:#cfffcf;&amp;quot;&amp;gt;&lt;br /&gt;
AscDriver()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes made to the codebase to get the GUI up and running with TkInter ===&lt;br /&gt;
&lt;br /&gt;
There was an issue with tktable which I couldn&#039;t fix and also found this bug report which might actually not be resolved:&lt;br /&gt;
http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
see also: https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also the trunk branch was missing the interval.c and interval.h files in ascend/compiler/.&lt;br /&gt;
I copied the files over from the Python3 branch and then the issue was solved&lt;br /&gt;
&lt;br /&gt;
In line 138 in solver.tcl the - bitmap {feet} and -bitmap{stop} options couldn&#039;t find the bitmaps in ascend/tcltk/tk/bitmaps.&lt;br /&gt;
&lt;br /&gt;
See the Notes section for other changes to get the tcl/tk interface working.&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
ASC_IMPORT???:&lt;br /&gt;
&lt;br /&gt;
Definition at line 124 of file ascend/general/platform.h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ASCENDTK:&lt;br /&gt;
&lt;br /&gt;
This environment variable is used to define the location of the Tcl/Tk support files&lt;br /&gt;
used by the ASCEND Tcl/Tk GUI. It defaults to $ASCENDDIST/TK. It has no effect on the PyGTK GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
asc_swap_del_backspace:&lt;br /&gt;
&lt;br /&gt;
set to &amp;quot;1&amp;quot; for unix systems&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__userdata_init:&lt;br /&gt;
&lt;br /&gt;
comment out&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
argc:&lt;br /&gt;
&lt;br /&gt;
set argument counter argc to 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
tktable missing:&lt;br /&gt;
&lt;br /&gt;
- install via sudo apt-get install tk-table&lt;br /&gt;
&lt;br /&gt;
- ascend still can&#039;t find tktable&lt;br /&gt;
&lt;br /&gt;
- install tcl8.5-dev, tk8.5-dev, libxft-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev&lt;br /&gt;
&lt;br /&gt;
- error: if {[catch {package require Tktable 2.8} err]} in ascend.tcl&lt;br /&gt;
&lt;br /&gt;
- http://bugs.ascend4.org/view.php?id=254&lt;br /&gt;
&lt;br /&gt;
- https://github.com/nbro/tktable/issues/3&lt;br /&gt;
&lt;br /&gt;
- The plot window and the solver window require the&lt;br /&gt;
&lt;br /&gt;
- TkTable exension package by Roland King mthomas 98.05.07: require 1.8 until we debug the memory errors in 2.0&lt;br /&gt;
&lt;br /&gt;
- comment the if clause block starting with line 225 in ascend.tcl out&lt;br /&gt;
&lt;br /&gt;
- Issue not yet resolved&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
error because interval.c and interval.h files were missing (trunk branch) in ascend/compiler/:&lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
bitmap &amp;quot;feet&amp;quot; not defined:&lt;br /&gt;
&lt;br /&gt;
- ascend.tcl line 259: awin all&lt;br /&gt;
&lt;br /&gt;
- awin is in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- ShowWindow.solver in line 108 in GlobalProc.tcl&lt;br /&gt;
&lt;br /&gt;
- line 138 in solver.tcl&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {feet} was removed because it couldn&#039;t be located&lt;br /&gt;
&lt;br /&gt;
- option -bitmap {stop} was removed&lt;br /&gt;
&lt;br /&gt;
Ascend starts with main GUI! Some windows or buttons still don&#039;t work.&lt;br /&gt;
&lt;br /&gt;
still having these error messages:&lt;br /&gt;
&lt;br /&gt;
Error calling set_Library_Defaults; invalid command name &amp;quot;libr_query (in NoteboxProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Probe_Defaults; invalid command name &amp;quot;__probe&amp;quot; (in ProbeProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Solver_Defaults; invalid command name &amp;quot;slv_available&amp;quot; (in SolverProc.tcl)&lt;br /&gt;
&lt;br /&gt;
Error calling set_Units_Defaults invalid command name &amp;quot;u_dim2num&amp;quot; (in UnitsProc.tcl)&lt;/div&gt;</summary>
		<author><name>MarkJones</name></author>
	</entry>
</feed>