|
| |||||||||
| Tags: console, programming language, python, script, terminal |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Python script starts only from console
Hello, I got into Python for some time and is a delight. I stumbled upon a small problem while beast. I created a very simple little game that works on hair, but the graphics were entirely within my script using commands create_line, create_rectangle, create_oval, etc. not knowing at the time how to work with pictures under Python. Now I duplicated the file of my game, and have replaced all my graphic part with calls to external images. Jpg and. Png. But since my script does not want to engage with the mouse, but only from the console. I have checked the file properties it was executable, but nothing works. Other scripts themselves, to throw out since my file browser. If someone has an idea? Thank you in advance. |
|
#2
| ||||
| ||||
| Re: Python script starts only from console
Hello, When you say run the script with the mouse, it's action that leads you to the window on which you have the choice between Show, Lancer, etc. ...? For my part, I always launch my scripts on the command line. I think I have not understood your exact problem, so if you explain more clearly then it would be more helpful to us. |
|
#3
| |||
| |||
| Re: Python script starts only from console
Hi No, when I speak to run the script with the mouse, I spoke to execute my script by double-clicking its icon in the file manager, like to open a document for example. My script starts up via the terminal but not otherwise. The other scripts I created to launch them all too well "in graphic" only through the terminal. |
|
#4
| |||
| |||
| Re: Python script starts only from console
Hello, If your program does not start per-click (or double-click depending on the settings), it is because he does not start in the correct folder (the one where your script) at once, it can not find your pictures and plant. In launching the console, you do not have this problem because the console is on file in your script. Your other scripts which they operate, must not use external files. The solution I use, at the beginning of each of my python programs I put these lines. Quote:
|
|
#5
| ||||
| ||||
| Re: Python script starts only from console
Hello, Just go through these part of code Code: import os, os.path, sys Code: HERE = os.path.dirname (sys.argv [0]) Code: APPDIR = os.path.abspath (HERE) I'm not sure we need to go through rather than APPDIR HERE but good.
__________________ Grand Theft Auto 4 PC Video Game |
|
#6
| ||||
| ||||
| Re: Python script starts only from console
Hello In addition for the above code, you can add this Code: sys.path.insert (0, APPDIR) Code: os.chdir (APPDIR) It changes the path system to be APPDIR.
__________________ The FIFA Manager 2009 PC Game |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Python script starts only from console" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ubuntu crashes after deleting a python script... | akhar | Operating Systems | 1 | 02-01-2010 09:55 AM |
| ComboFix Script and Recovery Console | Zipp | Windows Software | 4 | 07-11-2009 02:27 PM |
| How to call perl script from Python? | Jhonwho | Software Development | 3 | 23-07-2009 10:59 PM |
| Python starts slowly | Bigga Lexx | Software Development | 2 | 10-01-2009 06:18 PM |
| Recovery Console Starts Without Prompting for a Password | Plumdre | Windows Server Help | 4 | 06-08-2008 07:44 AM |