python 界面编程 并执行sh命令
2017-01-24 17:06
274 查看
#!/usr/bin/python # -*- coding: UTF-8 -*- from Tkinter import * # 导入 Tkinter 库 import thread import time import os class MessageShow: def __init__(self): #传入参数 消息内容 和这条消息显示的时间 #消息显示的时间 #self.WaitTime=time self.root = Tk() # 创建窗口对象的背景色 self.root.wm_title("机器人控制主窗口")#title #居中显示 self.root.resizable(False,False) self.root.update() # update window ,must do curWidth = self.root.winfo_reqwidth() # get current width curHeight = self.root.winfo_height() # get current height scnWidth,scnHeight = self.root.maxsize() # get screen width and height # now generate configuration information tmpcnf = '%dx%d+%d+%d'%(200,100, (scnWidth-curWidth)/2,(scnHeight-curHeight)/2) self.root.geometry(tmpcnf) #l1=Label(self.root,text=message,background="yellow") #font=("宋体", 12, "normal") #l1=Label(self.root,text=message,foreground="red") #l1.pack(side=TOP,expand=YES) b1=Button(self.root,text="启动机器人虚拟驱动",command=self.b1Command) #b1['width']=10 #b1['height']=1 b1.pack(side=TOP,expand=YES) b2=Button(self.root,text="启动机器人虚拟路径导航界面",command=self.b2Command) b2.pack() b3=Button(self.root,text="启动机器人movebase",command=self.b3Command) b3.pack() #thread.start_new_thread(self.autoDestory,()) self.root.mainloop() # 进入消息循环 def b1Command(self): os.system("gnome-terminal -x bash -c \"roslaunch agv fakeMinimalAGV.launch\"") def b2Command(self): os.system("gnome-terminal -x bash -c \"roslaunch agv mplannerfake.launch\"") def b3Command(self): os.system("gnome-terminal -x bash -c \"roslaunch agv move_base.launch\"") def autoDestory(self): time.sleep(self.WaitTime) self.root.destroy() if __name__=='__main__': MessageShow()
相关文章推荐
- python实现图形界面执行linux命令
- [原创][Python 技术培训] 第二周讲稿.面向对象编程初步及图形界面编程 (第二版)
- python编程-将Python程序转化为可执行程序
- python写的批量操作远程主机脚本(命令执行,上传、下载文件)
- 执行dos命令而不显示界面
- python下paramiko模块学习之一:ssh登录和执行命令
- (C#)Windows Shell 外壳编程系列4 - 上下文菜单(iContextMenu)(二)嵌入菜单和执行命令
- [转]Python执行系统命令的方法 os.system(),os.popen(),commands
- python执行第三方命令
- python 执行外部命令
- python写的批量操作远程主机脚本(命令执行,上传、下载文件)
- 新型生物计算机:分子编程活细胞执行命令
- (C#)Windows Shell 外壳编程系列4 - 上下文菜单(iContextMenu)(二)嵌入菜单和执行命令
- Python中执行shell命令的实例
- python执行shell命令
- python 执行系统命令比较[zz]
- python 执行系统命令比较
- python 执行外部命令
- 执行某个目录下的.sh命令
- VC界面编程,添加控件后可编译但不执行(即,不弹出对话框)