Posts: 56
Joined: Tue Dec 18, 2012 10:05 am

pyhton file

Thu Dec 27, 2012 1:13 am

Let's say i save a python file to the SD card.How to run the saved file using Raspberry Pi so that can get the output..

Posts: 310
Joined: Fri Aug 03, 2012 7:24 pm
Location: France
Contact: Website

Re: pyhton file

Thu Dec 27, 2012 4:38 pm

can you be more explaining ?
how did you write your python file ?
how did you save your file on the card ?
how do you use your Pi ?

we generally use python to execute python files :

Code: Select all

you can also add an interpreter on your script first line

Code: Select all

import RPi.GPIO
then make your script executable :

Code: Select all

chmod a+x

WebIOPi - Raspberry Pi REST Framework to control your Pi from the web

Posts: 56
Joined: Tue Dec 18, 2012 10:05 am

Re: pyhton file

Fri Dec 28, 2012 3:05 am

I want to create a FORM and put button and also update Labels using python.So how to do that.I'm new for python.

Posts: 759
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: pyhton file

Fri Dec 28, 2012 10:04 am

Use Tkinter

Tutorial here

There are other more complicated and newer gui toolkits but Tkinter is the ready installed native Python toolkit.
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from

Posts: 26
Joined: Fri Apr 13, 2012 9:54 am

Re: pyhton file

Mon Dec 31, 2012 6:12 pm


I had the same problem as the initial question: How do I run a Python script.

Wrote a quick blog on this - I now know 3 ways to do this.

First Python steps on my Raspberry Pi

Posts: 56
Joined: Tue Dec 18, 2012 10:05 am

Re: pyhton file

Fri Jan 04, 2013 12:44 am

Hi.Can i know what are the errors in my coding..

imprt pygtk
import gtk

class Helloworld:

def _init_(self):

self.window = gtk.wwindow()

self.window.set_title(("GTk Hello World = By Promosys")

self.window set_default_size

self.window.connect("destroy", self.quit)



self.menuBar= gtk.MenuBar()


self.fileMenu = gtk.Menu()

self.lightmyLEDMenuItem = gtk.MenuItem("Light My LED !!!")

self.lightmyLEDMenuItem.connect("activate", self.lightmyLEDMenuItem_clicked)





self.btnHelloworld =gtk.Button("hello World")

self.btnHelloworld.connect("clicked", self.btnhelloworld_clicked)




def btnHelloworld_Clicked(self, widget, data = Name):

self.messageBox = gtk.MessageDialog(flags = gtk.DIALOG_MODAL, buttons = gtk.BUTTONS_OK,message_format = "Hello World")

self.messageBox.format_secondary_text("By Promoys")

self.messageBox.connect("response", self.messageBox_Response)

def messageBox_Response(self, widget, data = Name):

if data == gtk.RESPONSE_OK:

def quit(self, widget, data = Name):


def exitMenuItem_Clicked(self,widget, data = Name):


def main(self):


if _name_ == "-main_":
helloworld = Helloworld()

User avatar
Forum Moderator
Forum Moderator
Posts: 2808
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: pyhton file

Fri Jan 04, 2013 9:40 am

You need to post you code between code tags.

If you look at the buttons above the text box when writing a post, you have...

B i u Quote Code

Click the Code one, then paste your code, then click it again. Then it will be readable...

Code: Select all

like this
Alex Eames RasPi.TV, RasP.iO

User avatar
Posts: 8
Joined: Wed Dec 19, 2012 4:22 pm
Location: Somerset, England

Re: pyhton file

Fri Jan 04, 2013 9:41 pm

This helped alot putting :-

#! /usr/bin/python

at the top of my .py or pyw files and right clicking on them and going to properties, permissions, make this file executable.

Is there a way to now make a icon for the ? And to have it so you double click and the just run's instead of [execute] [execute in terminal] [open] or [cancel] ?

What if my python program had like music.mid file's and image.png file's how do i package this into like a file.exe so i just double click and the game app just run's with everything it needs to hand. I am really new to python and to linux. Only ever used yellow dog linux on the playstation 3 till it was removed with a update.

Return to “Python”

Who is online

Users browsing this forum: No registered users and 10 guests