Main Window doesn't show up in my tk app 
Author Message
 Main Window doesn't show up in my tk app

Quote:

> int main (int argc, char * argv [])
> {
>         Tcl_Main (argc, argv, Tcl_AppInit);

          ^^^^^^^^

Tcl_Main() doesn't have an event loop.

Two solutions:
- Use Tk_Main() instead.
- Install the plus-patch for Tcl7.6 (this feature doesn't work
  with version 8.0 yet).

--
Jan Nijtmans, CMG (Computer Management Group) Arnhem B.V.


url:     http://www.*-*-*.com/ ~nijtmans/



Thu, 20 Apr 2000 03:00:00 GMT  
 Main Window doesn't show up in my tk app

I wrote the following main program:

--------------------------------------------------------------------
/**
 * Test for tk
 */

#include <stdio.h>
#include <tk.h>

int Tcl_AppInit(Tcl_Interp *interp)
{
    if (Tcl_Init(interp) == TCL_ERROR) {
                return TCL_ERROR;
    }
    if (Tk_Init(interp) == TCL_ERROR) {
                return TCL_ERROR;
    }
    Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
#ifdef TK_TEST
    if (Tktest_Init(interp) == TCL_ERROR) {
                return TCL_ERROR;
    }
    Tcl_StaticPackage(interp, "Tktest", Tktest_Init,
            (Tcl_PackageInitProc *) NULL);
#endif /* TK_TEST */

    /*
     * Call the init procedures for included packages.  Each call should
     * look like this:
     *
     * if (Mod_Init(interp) == TCL_ERROR) {
     *     return TCL_ERROR;
     * }
     *
     * where "Mod" is the name of the module.
     */

    /*
     * Call Tcl_CreateCommand for application-specific commands, if
     * they weren't already created by the init procedures called above.
     */

    /*
     * Specify a user-specific startup file to invoke if the application
     * is run interactively.  Typically the startup file is "~/.apprc"
     * where "app" is the name of the application.  If this line is
deleted
     * then no user-specific startup file will be run under any
conditions.
     */

    Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
    return TCL_OK;

Quote:
}

int main (int argc, char * argv [])
{
        Tcl_Main (argc, argv, Tcl_AppInit);
        return 0;
Quote:
}

-----------------------------------------------------------------------

I think this should work the same way as wish. But it only shows the
command prompt and no window. Why?

--

Schnepfwinkelstr. 10     Phone: +41 62 797 7908
CH-5745 Safenwil
Switzerland
-------------------------------------------------



Thu, 20 Apr 2000 03:00:00 GMT  
 Main Window doesn't show up in my tk app

Quote:

> I wrote the following main program:

> --------------------------------------------------------------------
> /**
>  * Test for tk
>  */

> #include <stdio.h>
> #include <tk.h>
> int main (int argc, char * argv [])
> {
>         Tcl_Main (argc, argv, Tcl_AppInit);
>         return 0;
> }
> -----------------------------------------------------------------------

> I think this should work the same way as wish. But it only shows the
> command prompt and no window. Why?

Call 'Tk_Main' instead of 'Tcl_Main'... ;-)

--- Roland
---



Thu, 20 Apr 2000 03:00:00 GMT  
 Main Window doesn't show up in my tk app

Quote:

> I wrote the following main program:

snip sni[

Quote:
> int main (int argc, char * argv [])
> {
>         Tcl_Main (argc, argv, Tcl_AppInit);
>         return 0;
> }
> -----------------------------------------------------------------------

> I think this should work the same way as wish. But it only shows the
> command prompt and no window. Why?

I would think it's because you called Tcl_Main instead of Tk_Main? Hmm??

--

VP Software Engineering    412 621 8333
NeoVision Hypersystems     412 621 8337 (fax)
5001 Baum Blvd
Pittsburgh, PA 15213



Fri, 21 Apr 2000 03:00:00 GMT  
 Main Window doesn't show up in my tk app

You need to call Tk_Main, instead of Tcl_Main in the main function.

int main (int argc, char * argv [])
{
         Tk_Main (argc, argv, Tcl_AppInit);
         return 0;

Quote:
}

--
---------------------------------------------------
Huseyin Bektas                  Office:508-916-7062
Bay Networks Inc.                  fax:508-916-8760

To revolutionize the way people work learn and play
by eliminating the constraints of distance and time
            http://www.baynetworks.com
---------------------------------------------------
Quote:

> I wrote the following main program:

> --------------------------------------------------------------------
> /**
>  * Test for tk
>  */

> #include <stdio.h>
> #include <tk.h>

> int Tcl_AppInit(Tcl_Interp *interp)
> {
>     if (Tcl_Init(interp) == TCL_ERROR) {
>                 return TCL_ERROR;
>     }
>     if (Tk_Init(interp) == TCL_ERROR) {
>                 return TCL_ERROR;
>     }
>     Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
> #ifdef TK_TEST
>     if (Tktest_Init(interp) == TCL_ERROR) {
>                 return TCL_ERROR;
>     }
>     Tcl_StaticPackage(interp, "Tktest", Tktest_Init,
>             (Tcl_PackageInitProc *) NULL);
> #endif /* TK_TEST */

>     /*
>      * Call the init procedures for included packages.  Each call should
>      * look like this:
>      *
>      * if (Mod_Init(interp) == TCL_ERROR) {
>      *     return TCL_ERROR;
>      * }
>      *
>      * where "Mod" is the name of the module.
>      */

>     /*
>      * Call Tcl_CreateCommand for application-specific commands, if
>      * they weren't already created by the init procedures called above.
>      */

>     /*
>      * Specify a user-specific startup file to invoke if the application
>      * is run interactively.  Typically the startup file is "~/.apprc"
>      * where "app" is the name of the application.  If this line is
> deleted
>      * then no user-specific startup file will be run under any
> conditions.
>      */

>     Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
>     return TCL_OK;
> }

> int main (int argc, char * argv [])
> {
>         Tcl_Main (argc, argv, Tcl_AppInit);
>         return 0;
> }
> -----------------------------------------------------------------------

> I think this should work the same way as wish. But it only shows the
> command prompt and no window. Why?

> --

> Schnepfwinkelstr. 10     Phone: +41 62 797 7908
> CH-5745 Safenwil
> Switzerland
> -------------------------------------------------



Sat, 22 Apr 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. (Repost) Tk 8.2: How to embed main Tk window in own (Win32) app

2. Tk 8.2: How to embed main Tk window in own app

3. canvas doesn't show up in TCL/TK plugin

4. Multiple main windows and apps in one tk process

5. Q: Tk app without main window?

6. twin (Windows Tk port): pack doesn't grow window

7. Tk with QT app doesn't work

8. Hiding main TK main window

9. tk app doesn't update screen under load

10. executing external TK scripts from a main TK app

11. Stop main window from closing app when child windows exist

12. Tcl/Tk doesn't trap the logoff/reboot/shutdown events on Windows

 

 
Powered by phpBB® Forum Software