askstring Window to the top under Windows

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • iwl

    askstring Window to the top under Windows

    Hi,

    I tryed askstring to input some text in my script,
    but some ugly empty Window appears with the
    Input-Window behind and all together behind my
    Console showing my script. So all have to brought
    to the top first by the user - very unconfortable

  • Jussi Salmela

    #2
    Re: askstring Window to the top under Windows

    iwl kirjoitti:
    Hi,
    >
    I tryed askstring to input some text in my script,
    but some ugly empty Window appears with the
    Input-Window behind and all together behind my
    Console showing my script. So all have to brought
    to the top first by the user - very unconfortable
    >
    Are you asking about the function AskString in the EasyDialogs module of
    Macintosh?

    If so, I can't help you.

    I'm just confused because the subject of your post contains the word
    Windows which could mean Microsoft Windows on which Python hasn't the
    EasyDialogs module.

    Cheers,
    Jussi

    Comment

    • Tim Golden

      #3
      Re: askstring Window to the top under Windows

      Jussi Salmela wrote:
      iwl kirjoitti:
      >Hi,
      >>
      >I tryed askstring to input some text in my script,
      >but some ugly empty Window appears with the
      >Input-Window behind and all together behind my
      >Console showing my script. So all have to brought
      >to the top first by the user - very unconfortable
      >>
      >
      Are you asking about the function AskString in the EasyDialogs module of
      Macintosh?
      >
      If so, I can't help you.
      >
      I'm just confused because the subject of your post contains the word
      Windows which could mean Microsoft Windows on which Python hasn't the
      EasyDialogs module.
      Not that I've used it, but...



      TJG

      Comment

      • Tim Golden

        #4
        Re: askstring Window to the top under Windows

        On Mar 6, 1:13 pm, "iwl" <Ingo.W...@gmx. dewrote:
        Hi,
        >
        I tryed askstring to input some text in my script,
        but some ugly empty Window appears with the
        Input-Window behind and all together behind my
        Console showing my script. So all have to brought
        to the top first by the user - very unconfortable
        It's not clear whether you're talking about the usual
        "Why do I get a DOS window when I run my python script?"
        question -- to which the answer is, in essence, change
        your script's extension to .pyw or use the pythonw.exe
        executable -- or "Why _when I use askstring_ do I get
        an empty window?". If it's the latter, then I don't
        know, but can you provide a small example script which
        exhibits the behaviour.

        TJG

        Comment

        • iwl

          #5
          Re: askstring Window to the top under Windows

          On 6 Mrz., 14:48, "Tim Golden" <tjgol...@gmail .comwrote:
          On Mar 6, 1:13 pm, "iwl" <Ingo.W...@gmx. dewrote:
          >
          It's not clear whether you're talking about the usual
          "Why do I get a DOS window when I run my python script?"
          question -- to which the answer is, in essence, change
          your script's extension to .pyw or use the pythonw.exe
          executable -- or "Why _when I use askstring_ do I get
          an empty window?". If it's the latter, then I don't
          know, but can you provide a small example script which
          exhibits the behaviour.
          >
          TJG
          >>import tkSimpleDialog
          >>tkSimpleDialo g.askstring("a" ,"b")
          at the python Console under XP (not pythonw).

          -instead of only showing the Inputwindow at the top,
          some additional empty window is shown, both not on top.

          Comment

          • Jussi Salmela

            #6
            Re: askstring Window to the top under Windows

            iwl kirjoitti:
            On 6 Mrz., 14:48, "Tim Golden" <tjgol...@gmail .comwrote:
            >On Mar 6, 1:13 pm, "iwl" <Ingo.W...@gmx. dewrote:
            >>
            >It's not clear whether you're talking about the usual
            >"Why do I get a DOS window when I run my python script?"
            >question -- to which the answer is, in essence, change
            >your script's extension to .pyw or use the pythonw.exe
            >executable -- or "Why _when I use askstring_ do I get
            >an empty window?". If it's the latter, then I don't
            >know, but can you provide a small example script which
            >exhibits the behaviour.
            >>
            >TJG
            >
            >>>import tkSimpleDialog
            >>>tkSimpleDial og.askstring("a ","b")
            >
            at the python Console under XP (not pythonw).
            >
            -instead of only showing the Inputwindow at the top,
            some additional empty window is shown, both not on top.
            >
            I assumed that by "python Console" you mean the IDLE editor/interpreter.
            I entered your 2 lines and the behaviour is the same on Win XP. I doubt
            it has nothing to do with the OS, though.

            (A word of warning but don't tell anyone: I've never used Tkinter, I use
            wxPython!)

            Every GUI implementation has a command loop and things to initiate the
            correct execution environment. I think that's what you are missing here
            and that's causing the odd behaviour.

            I found an example (16.1.2.2 A Simple Hello World Program) in Python 2.4
            and modified as shown:

            #============== =============== =============== ===
            from Tkinter import *
            import tkSimpleDialog # <<<=== modification here

            class Application(Fra me):
            def say_hi(self):
            print "hi there, everyone!"

            def createWidgets(s elf):
            self.QUIT = Button(self)
            self.QUIT["text"] = "QUIT"
            self.QUIT["fg"] = "red"
            self.QUIT["command"] = self.quit

            self.QUIT.pack( {"side": "left"})

            self.hi_there = Button(self)
            self.hi_there["text"] = "Hello",
            self.hi_there["command"] = self.say_hi

            self.hi_there.p ack({"side": "left"})

            def __init__(self, master=None):
            Frame.__init__( self, master)
            self.pack()
            self.createWidg ets()

            root = Tk()
            app = Application(mas ter=root)
            app.mainloop()
            tkSimpleDialog. askstring("a"," b") # <<<=== modification here
            root.destroy()
            #============== =============== =============== ===

            If you run it, it first shows the "Hello dialog" and after clicking the
            QUIT button, your askstring gets run.

            So: nothing wrong with Python, Tkinter or tkSimpleDialog. askstring.
            Just carry on having fun with Python!

            HTH,
            Jussi

            Comment

            • Jussi Salmela

              #7
              Re: askstring Window to the top under Windows

              Jussi Salmela kirjoitti:
              >
              ><snip>
              >
              Every GUI implementation has a command loop and things to initiate the
              OOPS: an EVENT loop

              Cheers,
              Jussi

              Comment

              • jim-on-linux

                #8
                Re: askstring Window to the top under Windows

                On Tuesday 06 March 2007 08:13, iwl wrote:
                Hi,
                >
                I tryed askstring to input some text in my
                script, but some ugly empty Window appears with
                the Input-Window behind and all together behind
                my Console showing my script. So all have to
                brought to the top first by the user - very
                unconfortable

                By default
                tk will open a root window.
                so you will have to create
                something to put into the
                root window.
                I suggest a button to open the tkSimpleDialog
                box.

                go to;

                An Introduction to Tkinter: Explore the essential Python library for GUI design. This guide covers widgets, event handling, and geometry management to help you build functional, cross-platform desktop apps.


                jim-on-linux

                Comment

                • iwl

                  #9
                  Re: askstring Window to the top under Windows

                  On 7 Mrz., 02:49, jim-on-linux <inq1...@verizo n.netwrote:
                  On Tuesday 06 March 2007 08:13, iwl wrote:
                  >
                  Hi,
                  >
                  I tryed askstring to input some text in my
                  script, but some ugly empty Window appears with
                  the Input-Window behind and all together behind
                  my Console showing my script. So all have to
                  brought to the top first by the user - very
                  unconfortable
                  >
                  By default
                  tk will open a root window.
                  Is this default changeable befor askstring?

                  Comment

                  • jim-on-linux

                    #10
                    Re: askstring Window to the top under Windows

                    On Wednesday 07 March 2007 05:05, iwl wrote:
                    On 7 Mrz., 02:49, jim-on-linux
                    <inq1...@verizo n.netwrote:
                    On Tuesday 06 March 2007 08:13, iwl wrote:
                    Hi,
                    >
                    I tryed askstring to input some text in my
                    script, but some ugly empty Window appears
                    with the Input-Window behind and all
                    together behind my Console showing my
                    script. So all have to brought to the top
                    first by the user - very unconfortable
                    By default
                    tk will open a root window.
                    >
                    Is this default changeable befor askstring?
                    Here is an example of a simple button that will
                    open a tkSimpleDialog box
                    ======

                    from Tkinter import *
                    import tkSimpleDialog
                    from tkSimpleDialog import askfloat

                    root = Tk() ## this is the default window
                    vlab = Button( root, text= 'Click here to Open
                    Dialog',
                    width = 20, height = 2,
                    bg = 'yellow',
                    command =(lambda: askfloat( 'Entery',
                    'Enter credit card number') ) )
                    vlab.grid()
                    mainloop()

                    jim-on-linux

                    Comment

                    • jim-on-linux

                      #11
                      Re: askstring Window to the top under Windows

                      On Wednesday 07 March 2007 05:02, Ingo Wolf wrote:
                      -------- Original-Nachricht --------
                      Datum: Tue, 06 Mar 2007 20:49:42 -0500
                      Von: jim-on-linux <inq1ltd@verizo n.net>
                      An: python-list@python.org
                      CC: "iwl" <Ingo.Wolf@gmx. de>
                      Betreff: Re: askstring Window to the top under
                      Windows
                      >
                      By default
                      tk will open a root window.
                      so you will have to create
                      something to put into the
                      root window.
                      I suggest a button to open the tkSimpleDialog
                      box.

                      go to;

                      The page you are looking for doesn't exist. Return to PythonWare for free online image conversion tools.

                      roduction/
                      >
                      I've allready had a short look trough this to
                      find an idea how to change this behavior (which
                      should be done by the askstring makers) but
                      haven't up to now. I think what I do is what
                      askstring was made for keeping me away from tk
                      internals only wanting a little string input.
                      >
                      Because I have embedded python In my C-App I
                      make my own window now In C and extend python
                      by it so having more control about things
                      happen.

                      Check out how to use Entry Wiget
                      for data entry.

                      ====

                      from Tkinter import *

                      root = Tk() ## this is the default window
                      vlab = Label(root, width = 20,
                      text = 'Enter data here')
                      vlab.grid( row=0, column =0)

                      ventry= Entry(root, width = 30)
                      ventry.grid(row = 0, column = 1)
                      mainloop()

                      jim-on-linux
                      http:\\www.inqvista.com







                      Comment

                      Working...