Simple Dialogs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • neil.fraser@gmail.com

    #1

    Simple Dialogs

    I'm looking for a lightweight dialog boxes from Python.
    JavaScript uses: alert(), confirm() and prompt()
    VB uses: MsgBox() and InputBox()
    EasyGui seemed perfect, but a "Hello World" application takes nearly a
    minute to execute after the program has been compiled by py2exe.

    There appear to be dozens of windowing toolkits avilable for Python,
    could someone point me in the direction of something lightweight?

    Thanks.

  • James Stroud

    #2
    Re: Simple Dialogs

    py> from tkMessageBox import askquestion, showerror
    py> from tkSimpleDialog import askfloa
    py> a = askfloat('Censu s Data', 'Enter Salary')
    py> print a
    12500.51
    py> a = askquestion('Op inion', 'Do you think windoze sucks?')
    py> print a
    yes
    py> a = showerror('Prob lem','Program Crashed before Starting')
    py> print a
    ok

    On Friday 23 September 2005 11:33, neil.fraser@gma il.com wrote:[color=blue]
    > I'm looking for a lightweight dialog boxes from Python.
    > JavaScript uses: alert(), confirm() and prompt()
    > VB uses: MsgBox() and InputBox()
    > EasyGui seemed perfect, but a "Hello World" application takes nearly a
    > minute to execute after the program has been compiled by py2exe.
    >
    > There appear to be dozens of windowing toolkits avilable for Python,
    > could someone point me in the direction of something lightweight?
    >
    > Thanks.[/color]

    --
    James Stroud
    UCLA-DOE Institute for Genomics and Proteomics
    Box 951570
    Los Angeles, CA 90095


    Comment

    • neil.fraser@gmail.com

      #3
      Re: Simple Dialogs

      James Stroud wrote:[color=blue]
      > from tkMessageBox import showerror
      > showerror('Prob lem','Program Crashed before Starting')[/color]

      Thanks. That works great when interpreted (though a blank window seems
      to open as well). Unfortunately it still takes 40 seconds to execute
      after it has been 'compiled' with py2exe (I've only got a P3). This
      probably has something to do with the fact that the resulting files for
      this two-liner weigh in at just under 8MB.

      Sounds like I'll need to write a one-line msgbox.exe in Visual Whatever
      or Euphoria and execute that from Python.

      Comment

      • neil.fraser@gmail.com

        #4
        Re: Simple Dialogs

        James Stroud wrote:[color=blue]
        > from tkMessageBox import showerror
        > showerror('Prob lem','Program Crashed before Starting')[/color]

        Here's a faster method, though not cross-platform:

        import ctypes
        ctypes.windll.u ser32.MessageBo xA(0, "Hello World", "Title", 0x00)

        Comment

        • Grant Edwards

          #5
          Re: Simple Dialogs

          On 2005-09-26, neil.fraser@gma il.com <neil.fraser@gm ail.com> wrote:[color=blue]
          > James Stroud wrote:[color=green]
          >> from tkMessageBox import showerror
          >> showerror('Prob lem','Program Crashed before Starting')[/color]
          >
          > Here's a faster method, though not cross-platform:
          >
          > import ctypes
          > ctypes.windll.u ser32.MessageBo xA(0, "Hello World", "Title", 0x00)[/color]

          Another easy way to do a dialog box:

          import os
          os.system('Xdia log --msgbox "Hello World" 0 0')

          --
          Grant Edwards grante Yow! I will establish
          at the first SHOPPING MALL in
          visi.com NUTLEY, New Jersey...

          Comment

          • Thorsten Kampe

            #6
            Re: Simple Dialogs

            * neil.fraser@gma il.com (2005-09-23 23:39 +0100)[color=blue]
            > James Stroud wrote:[color=green]
            >> from tkMessageBox import showerror
            >> showerror('Prob lem','Program Crashed before Starting')[/color]
            >
            > Thanks. That works great when interpreted (though a blank window seems
            > to open as well). Unfortunately it still takes 40 seconds to execute
            > after it has been 'compiled' with py2exe (I've only got a P3). This
            > probably has something to do with the fact that the resulting files for
            > this two-liner weigh in at just under 8MB.[/color]

            Try with Pyinstaller. There are issues with py2exe and EasyGui. I have
            a script that uses either EasyGui or EasyDialog (on Windows) and the
            Tkinter part crashes constantly (newest py2exe) while EasyDialogs
            works just fine.

            Compiled with Pyinstaller they both work fine (and the exe is at 1.7
            MB)

            Comment

            • Steve Holden

              #7
              Re: Simple Dialogs

              Grant Edwards wrote:[color=blue]
              > On 2005-09-26, neil.fraser@gma il.com <neil.fraser@gm ail.com> wrote:
              >[color=green]
              >>James Stroud wrote:
              >>[color=darkred]
              >>>from tkMessageBox import showerror
              >>>showerror('P roblem','Progra m Crashed before Starting')[/color]
              >>
              >>Here's a faster method, though not cross-platform:
              >>
              >>import ctypes
              >>ctypes.windll .user32.Message BoxA(0, "Hello World", "Title", 0x00)[/color]
              >
              >
              > Another easy way to do a dialog box:
              >
              > import os
              > os.system('Xdia log --msgbox "Hello World" 0 0')
              >[/color]

              Doesn't seem to work on my Winodws system at all ;-)

              regards
              Steve
              --
              Steve Holden +44 150 684 7255 +1 800 494 3119
              Holden Web LLC www.holdenweb.com
              PyCon TX 2006 www.pycon.org

              Comment

              • Grant Edwards

                #8
                Re: Simple Dialogs

                On 2005-09-26, Steve Holden <steve@holdenwe b.com> wrote:
                [color=blue][color=green][color=darkred]
                >>>>from tkMessageBox import showerror
                >>>>showerror(' Problem','Progr am Crashed before Starting')
                >>>
                >>>Here's a faster method, though not cross-platform:
                >>>
                >>>import ctypes
                >>>ctypes.windl l.user32.Messag eBoxA(0, "Hello World", "Title", 0x00)[/color]
                >>
                >> Another easy way to do a dialog box:
                >>
                >> import os
                >> os.system('Xdia log --msgbox "Hello World" 0 0')[/color]
                >
                > Doesn't seem to work on my Winodws system at all ;-)[/color]

                Odd. You don't have a full compliment of the usual GTK apps
                installed?

                I probably should have mentioned that Xdialog is a GTK+ app and
                it needs to be installed and working on your platform.

                In thoery, you could get it to work under Windows, but the last
                time I checked, the Windows port of GTK+ was still a bit "beta".

                --
                Grant Edwards grante Yow! What PROGRAM are
                at they watching?
                visi.com

                Comment

                • William Park

                  #9
                  Re: Simple Dialogs

                  neil.fraser@gma il.com wrote:[color=blue]
                  > I'm looking for a lightweight dialog boxes from Python.
                  > JavaScript uses: alert(), confirm() and prompt()
                  > VB uses: MsgBox() and InputBox()
                  > EasyGui seemed perfect, but a "Hello World" application takes nearly a
                  > minute to execute after the program has been compiled by py2exe.
                  >
                  > There appear to be dozens of windowing toolkits avilable for Python,
                  > could someone point me in the direction of something lightweight?[/color]

                  If you can run it outside Python, then

                  will get you started.

                  If you must run it inside Python, then you should look into Python
                  wrapper for GTK+, and write the code yourself.

                  --
                  William Park <opengeometry@y ahoo.ca>, Toronto, Canada
                  ThinFlash: Linux thin-client on USB key (flash) drive

                  BashDiff: Super Bash shell
                  Compare the best free open source Software Development Software at SourceForge. Free, secure and fast Software Development Software downloads from the largest Open Source applications and software directory

                  Comment

                  Working...