pyhton file
8 posts
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: 56
- Joined: Tue Dec 18, 2012 10:05 am
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 :
you can also add an interpreter on your script first line
then make your script executable :
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
python myfile.py
you can also add an interpreter on your script first line
- Code: Select all
#!/usr/bin/python
import RPi.GPIO
...
then make your script executable :
- Code: Select all
chmod a+x myfile.py
WebIOPi - Raspberry Pi REST Framework to control your Pi from the web
http://store.raspberrypi.com/projects/webiopi
http://code.google.com/p/webiopi/
http://trouch.com
- Posts: 308
- Joined: Fri Aug 03, 2012 7:24 pm
- Location: France
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: 56
- Joined: Tue Dec 18, 2012 10:05 am
Use Tkinter
Tutorial here http://effbot.org/tkinterbook/tkinter-index.htm
There are other more complicated and newer gui toolkits but Tkinter is the ready installed native Python toolkit.
Tutorial here http://effbot.org/tkinterbook/tkinter-index.htm
There are other more complicated and newer gui toolkits but Tkinter is the ready installed native Python toolkit.
Pi Presents - A display package for museums, visitor centres, and more
Download from http://pipresents.wordpress.com
Download from http://pipresents.wordpress.com
- Posts: 318
- Joined: Tue Jan 24, 2012 9:30 am
- Location: Hertfordshire, UK
Hi,
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.
See
First Python steps on my Raspberry Pi http://nvdd.info/Vs7JFk
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.
See
First Python steps on my Raspberry Pi http://nvdd.info/Vs7JFk
- Posts: 26
- Joined: Fri Apr 13, 2012 9:54 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.verticalcontainer.margin=5
self.window.add(self.verticalcontainer)
self.verticalcontainer.show()
self.menuBar= gtk.MenuBar()
self.fileMenuItem=gtk.MenuItem("File")
self.fileMenu = gtk.Menu()
self.lightmyLEDMenuItem = gtk.MenuItem("Light My LED !!!")
self.lightmyLEDMenuItem.connect("activate", self.lightmyLEDMenuItem_clicked)
self.fileMenu.add(self.exitMenuItem)
self.exitMenuItem.show()
self.fileMenuItem.set_submenu(self.fileMenu)
self.fileMenu.show()
self.menuBar.add(self.fileMenuItem)
self.fileMenuItem.show()
self.verticalcontainer.add(self.menuBar)
self.menuBar.show()
self.btnHelloworld =gtk.Button("hello World")
self.btnHelloworld.connect("clicked", self.btnhelloworld_clicked)
self.verticalcontainer.add(self.btnHelloworld)
self.btnHelloworld.show()
self.imageBox.set_from_file("pi.png")
self.verticalcontainer.add(self.imageBox)
self.imageBox.show()
self.window.show()
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)
self.messageBox.show()
def messageBox_Response(self, widget, data = Name):
if data == gtk.RESPONSE_OK:
self.messageBox.hide()
def quit(self, widget, data = Name):
gtk.main_quit()
def exitMenuItem_Clicked(self,widget, data = Name):
gtk.main_quit()
def main(self):
gtk.main()
if _name_ == "-main_":
helloworld = Helloworld()
helloworld.main()
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.verticalcontainer.margin=5
self.window.add(self.verticalcontainer)
self.verticalcontainer.show()
self.menuBar= gtk.MenuBar()
self.fileMenuItem=gtk.MenuItem("File")
self.fileMenu = gtk.Menu()
self.lightmyLEDMenuItem = gtk.MenuItem("Light My LED !!!")
self.lightmyLEDMenuItem.connect("activate", self.lightmyLEDMenuItem_clicked)
self.fileMenu.add(self.exitMenuItem)
self.exitMenuItem.show()
self.fileMenuItem.set_submenu(self.fileMenu)
self.fileMenu.show()
self.menuBar.add(self.fileMenuItem)
self.fileMenuItem.show()
self.verticalcontainer.add(self.menuBar)
self.menuBar.show()
self.btnHelloworld =gtk.Button("hello World")
self.btnHelloworld.connect("clicked", self.btnhelloworld_clicked)
self.verticalcontainer.add(self.btnHelloworld)
self.btnHelloworld.show()
self.imageBox.set_from_file("pi.png")
self.verticalcontainer.add(self.imageBox)
self.imageBox.show()
self.window.show()
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)
self.messageBox.show()
def messageBox_Response(self, widget, data = Name):
if data == gtk.RESPONSE_OK:
self.messageBox.hide()
def quit(self, widget, data = Name):
gtk.main_quit()
def exitMenuItem_Clicked(self,widget, data = Name):
gtk.main_quit()
def main(self):
gtk.main()
if _name_ == "-main_":
helloworld = Helloworld()
helloworld.main()
- Posts: 56
- Joined: Tue Dec 18, 2012 10:05 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...
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
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 file.py ? And to have it so you double click and the file.py 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.
#! /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 file.py ? And to have it so you double click and the file.py 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.