-
Notifications
You must be signed in to change notification settings - Fork 1
python_example
Kelleher Guerin edited this page Sep 20, 2013
·
1 revision
This is a sample application written in python which uses Qt (PySide) to display an empty widget on the wall. This example assumes you have gone through the WallFrame Tutorials and Overview and also understand what is going on with ROS and PySide
#!/usr/bin/env python
import roslib; roslib.load_manifest('modulair_app_python_example')
import rospy, sys
# Modulair Core Functionality
import modulair_core
from modulair_core import ModulairAppWidget
# PySide Imports
import PySide
from PySide.QtGui import QApplication
class PythonAppWidget(ModulairAppWidget):
def __init__(self,name,app):
super(PythonAppWidget,self).__init__(name,app)
# Any child widgets should be put here and made with 'self' as a parent
pass
class PythonExampleApp():
def __init__(self):
rospy.init_node('python_example_app',anonymous=True)
app = QApplication(sys.argv)
app_widget = PythonAppWidget("PythonExampleApp",app)
# Running
rospy.logwarn("PythonExampleApp: Started")
app.exec_()
# Done
rospy.logwarn('PythonExampleApp: Finished')
# MAIN
if __name__ == '__main__':
app = PythonExampleApp()
This is where we inherit the base python application class and initialize it with super
class PythonAppWidget(ModulairAppWidget):
def __init__(self,name,app):
super(PythonAppWidget,self).__init__(name,app)