I like python.

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

    #1

    I like python.

    I'm not a coder.. I'm just a person that trys to do things with
    languages he likes. Sometimes I'm successful, mostly not. I do know
    that before I bother a list with a silly question I should do my best
    to research for an answer myself. ala RTFM. That said my searches
    haven't found me what I am looking.. lack of a decent keyword
    sequence.. anywho..

    Could someone please tell me what I need to put into a python script
    to not have a window come up however briefly? Like when I double click
    on the script, it will do it's job but won't open a command window
    then close it.. I hope that explains what I'm looking for. If I see
    the line I can figure out by syntax where it should go. I'm really
    good at learning the gist of languages by syntax. Thank you all for
    your time


    Peace
    --
    Fidel
  • MC

    #2
    Re: I like python.

    Hi!

    Sorry, I don't understand well english.
    But, try to rename your script, from .py to .pyw (sample : titi.py ==>
    titi.pyw).

    --
    @-salutations

    Michel Claveau


    Comment

    • Fidel

      #3
      Re: I like python.

      Renaming the file doesn't work. I am on windows... There is a specific
      line of code that tells python not to bother even opening a window. of
      any sort for any amount of time. I just don't know what it is and
      haven't been able to find any reference to it.... Thanks for the help
      though.
      >assuming Windows, and assuming that you have a standard Python install for
      >Windows: use "pyw" instead of "py" as the script's extension.
      >
      >(Windows applications come in two flavours: console applications and window
      >applications . the default executable for "py" files is "python.exe ",
      which is a con-
      >sole application. "pyw" uses "pythonw.ex e" instead, which is exactly the same
      >program, but linked as a window application instead).
      >
      ></F>


      On 10/20/06, MC <XX.XmcX@xx.xmc laveaux.comwrot e:
      Hi!
      >
      Sorry, I don't understand well english.
      But, try to rename your script, from .py to .pyw (sample : titi.py ==>
      titi.pyw).
      >
      --
      @-salutations
      >
      Michel Claveau
      >
      >
      --

      >

      --
      Fidel

      Comment

      • Simon Forman

        #4
        Re: I like python.

        Fidel wrote:
        Renaming the file doesn't work. I am on windows...
        Are you sure? Double-clicking on a *.pyw script file really brings up
        a window? Is it a GUI window or a console window? I ask because if
        it's a console window and you're really clicking on a .pyw file then it
        really should run without opening the console window. If not then
        there might be some problem with your python installation. But it's
        much more likely that you, say, copied the script and renamed the copy
        but then accidentally clicked on the old script.
        There is a specific
        line of code that tells python not to bother even opening a window. of
        How do you know this?


        Peace,
        ~Simon

        Comment

        • Jerry

          #5
          Re: I like python.

          On Oct 20, 2:59 am, Fidel <fidel.andr...@ gmail.comwrote:
          Could someone please tell me what I need to put into a python script
          to not have a window come up however briefly? Like when I double click
          on the script, it will do it's job but won't open a command window
          then close it.. I hope that explains what I'm looking for. If I see
          the line I can figure out by syntax where it should go. I'm really
          good at learning the gist of languages by syntax. Thank you all for
          your time
          Are you running any external commands by using os.system() or
          os.exec()? If you are running a program that is a console program
          (i.e. copy, move, del, etc...) then it will open up a command window to
          run it. If that is the case, then you can try using the os.popen()
          utility instead.

          --
          Jerry

          Comment

          • Ant

            #6
            Re: I like python.


            Fidel wrote:
            Renaming the file doesn't work. I am on windows... There is a specific
            line of code that tells python not to bother even opening a window.
            Seriously, renaming the script to .pyw should work from a standard
            python install. If it doesn't then the file handler for that extension
            must have got messed up somewhere along the way. You can fix this by
            right-clicking the renamed (*.pyw) file and selecting "open with..." ->
            "Choose Program" and finding the pythonw.exe.

            Comment

            • Fidel

              #7
              Re: I like python.

              Although I just noticed that if the extension is .py then it will
              still open a command window. It does indeed need to have a .pyw
              extension for this to work. So all of you were correct. it needs to
              use popen and have .pyw as the extension in order for python not to
              open a command window. Thank you all for you help and support.

              On 20 Oct 2006 14:28:23 -0700, Ant <antroy@gmail.c omwrote:
              >
              Fidel wrote:
              Renaming the file doesn't work. I am on windows... There is a specific
              line of code that tells python not to bother even opening a window.
              >
              Seriously, renaming the script to .pyw should work from a standard
              python install. If it doesn't then the file handler for that extension
              must have got messed up somewhere along the way. You can fix this by
              right-clicking the renamed (*.pyw) file and selecting "open with..." ->
              "Choose Program" and finding the pythonw.exe.
              >
              --

              >

              --
              Fidel

              Comment

              • Fidel

                #8
                Re: I like python.

                Thank you Jerry. That was exactly what I was looking for. The script
                in fact does call an external program and give it a command from a
                randomized list. Specifically it is a random wallpaper setter using
                the windows version of bsetroot. script scans a directory, creates a
                list of viable walls and tells bsetroot to set the wallpaper. Using
                popen instead of system did the trick handily. I thank you verily.

                On 20 Oct 2006 14:21:59 -0700, Jerry <jweida@gmail.c omwrote:
                On Oct 20, 2:59 am, Fidel <fidel.andr...@ gmail.comwrote:
                Could someone please tell me what I need to put into a python script
                to not have a window come up however briefly? Like when I double click
                on the script, it will do it's job but won't open a command window
                then close it.. I hope that explains what I'm looking for. If I see
                the line I can figure out by syntax where it should go. I'm really
                good at learning the gist of languages by syntax. Thank you all for
                your time
                >
                Are you running any external commands by using os.system() or
                os.exec()? If you are running a program that is a console program
                (i.e. copy, move, del, etc...) then it will open up a command window to
                run it. If that is the case, then you can try using the os.popen()
                utility instead.
                >
                --
                Jerry
                >
                --

                >

                --
                Fidel

                Comment

                • Jerry

                  #9
                  Re: I like python.

                  Glad I could help.

                  --
                  Jerry

                  Comment

                  Working...