[英]How to run a python program(containing tkinter) on startup
I want to execute a simple python script that contain tkinter window on start up of raspberry pi. 我想在树莓派启动时执行一个包含tkinter窗口的简单python脚本。 and the tkinter window will appear on the monitor.
并且tkinter窗口将出现在监视器上。 suppose my simple script is
假设我的简单脚本是
import Tkinter
from Tkinter import *
root = Tk()
root.mainloop()
I have tried the following procedure and failed 我尝试了以下步骤,但失败了
mkdir ./bin
cd ./bin
sudo nano script_auto_run
then wrote the following code 然后写了下面的代码
#!/bin/bash
sudo python /home/pi/projects/test.py
to make it executable i ran 使它可执行我跑
sudo chmod 755 script_auto_run
edited the rc.local file 编辑了rc.local文件
sudo nano /etc/rc.local
and added the following line before exit0 并在exit0之前添加了以下行
/home/pi/bin/script_auto_run
what mistake am I doing? 我在做什么错?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.