Issues with checkbutton widget (Tkinter) with Python!

Discussion in 'Software' started by jde0503, Feb 19, 2012.

  1. jde0503

    jde0503 Private E-2

    I am using Python to communicate with an Arduino microprocessor with the goal of controlling an ROV (remotely operated vehicle). As such I am developing a GUI with the Tkinter Python module and am having some difficulty creating a functioning checkbotton widget. I am able to have one appear within the gui, howevere, I cannot seem to assign its two seperate functions (in this case to turn cameras on via Arduino and to turn cameras off). I used the toggle command and need help accomplishing the to functions within the toggle command. Here is the section of my code pertaining to the checkbutton; as of now the checkbutton is not assigned to any real function other to print out what it should be doing--essentially what I want it to do (for now) is it to print that cameras are on when selected and off when deselected:

    self.checkbuttonCameraPower = Tkinter.Checkbutton(self,text=u"Power to Cameras",indicatoron=0,bd=3,selectcolor="lightgreen",command=self.toggleCameraPower,width=20)

    def toggleCameraPower(self):
    if self.verbose:
    print 'Cameras On/Off'

    Can anyone help?:cry
     
  2. PC-XT

    PC-XT Master Sergeant

    If I understand, you just want to make the toggleCameraPower command have two routines, one for its "down" state and another for its "up" state. I think I would use a variable, as well as the command, to get the state, like the last example here: http://effbot.org/tkinterbook/checkbutton.htm
     
  3. jde0503

    jde0503 Private E-2

    To be completely honest, I am just learning the Python programming language, and programming in general. What you've just said and the examples at the link you provided make very little sense to me in a practical way. I can grasp the concept, but not the "how". Could you, given my entire code thus far (below), write a functioning example for me that would work within my code?

    Code:
    #!/usr/bin/python
    
    ################################################################################
    
    import Tkinter
    import serial
    import time
    import os
    import re
    import pygame
    
    ################################################################################
    
    class ROVCMD(Tkinter.Tk):
        
    ################################################################################
    
        def __init__(self,parent):
            Tkinter.Tk.__init__(self,parent)
            self.parent = parent
            self.root = Tkinter.Tk()
            self.initialize()
        
        ############################################################################
        
        def initialize(self):
            
            #####################################
            # First set the version and verbosity (printed output to terminal)
            self.version = 1.1
            self.verbose = True
            
            if self.verbose:
                print '---------------------------------'
                print 'ROVCMD Version ',self.version
                print '---------------------------------'
            
            #####################################
            # Setup the serial communication with the Arduino microprocessor
            #
            # Get list of all device driver names
            DeviceDriverList = os.listdir("/dev")
            
            # Look for a USB driver associated with an Arduino miroprocessor
            #    On the Mac look for a USB driver named "tty.usbmodemXXXXX" where "XXXXX" is something like "fa141"
            #    On some Linux machines look for a USB driver named "/dev/ttyUSBx" where "x" is something like "0"
            #        On an Ubuntu Linux machine look for a USB driver named "/dev/ttyACM0"
            sre = re.compile('tty.usbmodem*')
            USBModemList = [elem for elem in DeviceDriverList if sre.match(elem)]
            if len(USBModemList) <= 0:
                sre = re.compile('ttyUSB*')
                USBModemList = [elem for elem in DeviceDriverList if sre.match(elem)]
            if len(USBModemList) <= 0:
                sre = re.compile('ttyACM0')
                USBModemList = [elem for elem in DeviceDriverList if sre.match(elem)]
            
            # If the Arduino USB driver has been found, start it up
            if len(USBModemList) > 0:
                self.serialBaudRate = 19200
                USBModem = "/dev/" + USBModemList[0]
                self.arduinoSerial = serial.Serial(USBModem, self.serialBaudRate, timeout=0.001)
                self.serialDelay = 0.100
                self.serialTimeout = 0.100
                self.arduinoSerial.flushOutput()
                self.arduinoSerial.flushInput()
                self.arduinoOk = True
                if self.verbose:
                    print "Initializing Arduino USB Serial communication"
                    print "    List of available USB modem devices:",USBModemList
                    print "    Arduino USB device driver:",USBModem
                    print "    Serial baud rate:",self.serialBaudRate
            else:
                self.arduinoOk = False
                if self.verbose:
                    print "Unable to open a serial port to an Arduino - giving up..."
            if self.verbose:
                print '---------------------------------'
                
            # Set the time interval in decimal seconds beyond which communication is considered broken
            self.CommTimeMaxInterval = 10.0
            
            #####################################
            #
            # Initialize joysticks
            
            # Initialize pyGame
            pygame.joystick.init()
            pygame.display.init()
            
            # Allow multiple joysticks
            self.joy = []
            
            # Declare axis displacement vector for an Xbox 360 Controller
            self.displacement = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
            
            # Look for a connected joystick
            if pygame.joystick.get_count() > 0:
                if self.verbose:
                    print 'External Controller (joystick(s)) detected: ',pygame.joystick.get_count()
                self.joystickOk = True
                for i in range(pygame.joystick.get_count()):
                    myjoy = pygame.joystick.Joystick(i)
                    myjoy.init()
                    self.joy.append(myjoy)
                    if self.verbose:
                        print ' Joystick ',i,':',self.joy[i].get_name()
            else:
                self.joystickOk = False
                if self.verbose:
                    print 'No joysticks detected...'
            if self.verbose:
                print '---------------------------------'
            
            #####################################
            
            # Set the time interval in integer milliseconds at which sensor data are requested
            self.SensorRequestInterval = 1000
            
            #####################################
            
            # Wait a bit to let the serial port initialization get handled everywhere
            time.sleep(2.0);
            
            ############################################################################
            
            # Next set up all the graphical widgets and global variables
            self.init_widgets()
            
            # Finally update the widget displays
            self.update_widgets()
            
        def init_widgets(self):
            
            # Define and initialize the variables related to the widgets
    	
    	# Define Time Variables
    	self.ArduinoTime = 0
    	self.CommROVLastTime = 0
    	self.CommJoystickLastTime = 0
    	self.CameraPowerLastTime = 0
    	self.Tool1LastTime = 0
    	self.Tool2LastTime = 0
    	self.Tool3LastTime = 0
    	self.Tool4LastTime = 0
    	self.Tool5LastTime = 0
    	self.Tool6LastTime = 0
    	self.Sensor1LastTime = 0
            self.Sensor2LastTime = 0
    	self.Sensor3LastTime = 0
    	self.Sensor4LastTime = 0
    	self.Sensor5LastTime = 0
    	self.TimeSampleIntervalLastTime = 0
    	self.SensorSampleIntervalLastTime = 0
    	self.ArduinoTimeLastTime = 0
    	
            # Values associated with ROV functions
            self.RHPower = 0
    	self.LHPower = 0
    	self.VPower = 0
    	self.SPower = 0
    	self.CameraPower = 0
    	self.Tool1Power = 0
            self.Tool2Power = 0
    	self.Tool3Power = 0
    	self.Tool4Power = 0
    	self.Tool5Power = 0
    	self.Tool6Power = 0
    	self.TimeSampleInterval = self.SensorRequestInterval
    	self.SensorSampleInterval = self.SensorRequestInterval
    	self.Sensor1 = 0
    	self.Sensor2 = 0
    	self.Sensor3 = 0
    	self.Sensor4 = 0
    	self.Sensor5 = 0
    	self.Temperature = 0
    	self.TemperatureLastTime = 0
    	self.Depth = 0
    	self.DepthLastTime = 0
    	
            # Define the widgets
            
            # Set the window title of the ROV GUI
            self.title('ROV Control Panel')
            
            self.grid()
            
            irow = 0
            
            #####################################
            
            self.labelCommROVString = Tkinter.StringVar()
    	self.labelCommROV = Tkinter.Label(self,textvariable=self.labelCommROVString,anchor="c",relief="ridge",fg="black",bg="red",width=50)
    	self.labelCommROV.grid(column=0,row=irow,columnspan=2,sticky='EW')
    	self.labelCommROVString.set(u"Communication With ROV")
    	
    	#####################################
    	
    	self.labelCommJoystickString = Tkinter.StringVar()
    	self.labelCommJoystick = Tkinter.Label(self,textvariable=self.labelCommJoystickString,anchor="c",relief="ridge",fg="black",bg="red",width=50)
    	self.labelCommJoystick.grid(column=0,row=(irow+1),columnspan=2,sticky='EW')
    	self.labelCommJoystickString.set(u"Control Via Joystick")
    	
    	#####################################
    	
    	self.labelDepthString = Tkinter.StringVar()
    	self.labelDepth = Tkinter.Label(self,textvariable=self.labelDepthString,anchor="c",relief="ridge",fg="black",bg="red",width=25)
    	self.labelDepth.grid(column=2,row=irow,columnspan=1,sticky='EW')
    	self.labelDepthString.set(u"Vehicle Depth: ? meters")
    	
    	#####################################
    	
    	self.labelTemperatureString = Tkinter.StringVar()
    	self.labelTemperature = Tkinter.Label(self,textvariable=self.labelTemperatureString,anchor="c",relief="ridge",fg="black",bg="red",width=25)
    	self.labelTemperature.grid(column=2,row=(irow+1),columnspan=1,sticky='EW')
    	self.labelTemperatureString.set(u"Temperature: ? deg C")
    	
    	#####################################
    	
    	irow = irow + 2
    	
    	self.labelBlankString = Tkinter.StringVar()
    	self.labelBlankString.set(u"----------------------------------------------------------------------")
    	self.labelBlank1 = Tkinter.Label(self,textvariable=self.labelBlankString,anchor="c",fg="black",bg="white",width=25)
    	self.labelBlank1.grid(column=0,row=irow,columnspan=3,sticky='EW')
    	
    	#####################################
    	
    	irow = irow + 1
    	
    	self.checkbuttonCameraPower = Tkinter.Checkbutton(self,text=u"Power to Cameras",indicatoron=0,bd=3,selectcolor="lightgreen",command=self.toggleCameraPower,width=20)
    	self.checkbuttonCameraPower.grid(column=1,row=irow)
    	
    	#####################################
    	
    	irow = irow +1
    	
    	self.labelBlank2 = Tkinter.Label(self,textvariable=self.labelBlankString,anchor="c",fg="black",bg="white",width=25)
    	self.labelBlank2.grid(column=0,row=irow,columnspan=3,sticky='EW')
    	
    	#####################################
    	
    	irow = irow + 1
    	
    	self.scaleThrusterLeftHorizontal = Tkinter.Scale(self,from_=100,to=-100,label="Left Horizontal Thruster",command=self.scaleThrusterLeftHorizontalMove)
    	self.scaleThrusterLeftHorizontal.grid(column=0,row=irow)
    	
    	#####################################
    	
    	self.scaleThrusterVertical = Tkinter.Scale(self,from_=100,to=-100,label="Vertical Thrusters",command=self.scaleThrusterVerticalMove)
    	self.scaleThrusterVertical.grid(column=1,row=irow)
    	
    	#####################################
    	
    	self.scaleThrusterRightHorizontal = Tkinter.Scale(self,from_=100,to=-100,label="Right Horizontal Thruster",command=self.scaleThrusterRightHorizontalMove)
    	self.scaleThrusterRightHorizontal.grid(column=2,row=irow)
    	
    	#####################################
    	
    	irow = irow + 1
    	
            self.scaleThrusterStrafe = Tkinter.Scale(self,from_=-100,to=100,label="Strafe Thrusters",orient="horizontal",command=self.scaleThrusterStrafeMove)
            self.scaleThrusterStrafe.grid(column=1,row=irow)
    	
    	#####################################
    	
    	irow = irow + 1
    	
    	self.labelBlank3 = Tkinter.Label(self,textvariable=self.labelBlankString,anchor="c",fg="black",bg="white",width=25)
    	self.labelBlank3.grid(column=0,row=irow,columnspan=3,sticky='EW')
    	
        #####################################
        
        def toggleCameraPower(self):
        	if self.verbose:
    		print 'Cameras On/Off'
    		
        #####################################
        
        def scaleThrusterLeftHorizontalMove(self,value):
        	if self.verbose:
    		print 'Left Horizontal Thruster:',value
    	ivalue = int((int(value) * 255) / 100)
    
        #####################################
        
        def scaleThrusterVerticalMove(self,value):
        	if self.verbose:
    		print 'Vertical Thrusters:',value
    	ivalue = int((int(value) * 255) / 100)
            
        #####################################
        
        def scaleThrusterRightHorizontalMove(self,value):
        	if self.verbose:
    		print 'Right Horizontal Thruster:',value
    	ivalue = int((int(value) * 255) / 100)
    	
        #####################################
       
        def scaleThrusterStrafeMove(self,value):
        	if self.verbose:
    		print 'Strafe Thrusters:',value
    	ivalue = int((int(value) * 255) / 100)
    	    
       #####################################
       
        def SerialToArduino(self, message):
        
        	self.arduinoSerial.write(message)
    	timeNow = time.time()
    	
    	time.sleep(self.serialDelay);
    	
        #####################################
        
        def update_widgets(self):
            print "Executing update_widgets()"
    	
    ############################################################################
    
    if __name__ == "__main__":
    
        # Create instance of the ROVCMD class
        app = ROVCMD(None)
    
        # Drop into the main loop to handle events
        app.mainloop()
    
    ############################################################################
    
     
  4. PC-XT

    PC-XT Master Sergeant

    It's been a while since I've done anything with python, myself, so I don't have anything to test this code. I don't know about Arduino.

    I'm not sure what the exact routine for turning the cameras on or off are. Your code has CameraPower and CameraPowerLastTime, but I'm not sure what they are for, so just to seperate the printing of the on/off, I created a new variable, called CameraPowerThisTime. If it causes ambiguity or something, just rename it in the 3 places:
    Code:
    #!/usr/bin/python
    
    ################################################################################
    
    import Tkinter
    import serial
    import time
    import os
    import re
    import pygame
    
    ################################################################################
    
    class ROVCMD(Tkinter.Tk):
        
    ################################################################################
    
        def __init__(self,parent):
            Tkinter.Tk.__init__(self,parent)
            self.parent = parent
            self.root = Tkinter.Tk()
            self.initialize()
        
        ############################################################################
        
        def initialize(self):
            
            #####################################
            # First set the version and verbosity (printed output to terminal)
            self.version = 1.1
            self.verbose = True
            
            if self.verbose:
                print '---------------------------------'
                print 'ROVCMD Version ',self.version
                print '---------------------------------'
            
            #####################################
            # Setup the serial communication with the Arduino microprocessor
            #
            # Get list of all device driver names
            DeviceDriverList = os.listdir("/dev")
            
            # Look for a USB driver associated with an Arduino miroprocessor
            #    On the Mac look for a USB driver named "tty.usbmodemXXXXX" where "XXXXX" is something like "fa141"
            #    On some Linux machines look for a USB driver named "/dev/ttyUSBx" where "x" is something like "0"
            #        On an Ubuntu Linux machine look for a USB driver named "/dev/ttyACM0"
            sre = re.compile('tty.usbmodem*')
            USBModemList = [elem for elem in DeviceDriverList if sre.match(elem)]
            if len(USBModemList) <= 0:
                sre = re.compile('ttyUSB*')
                USBModemList = [elem for elem in DeviceDriverList if sre.match(elem)]
            if len(USBModemList) <= 0:
                sre = re.compile('ttyACM0')
                USBModemList = [elem for elem in DeviceDriverList if sre.match(elem)]
            
            # If the Arduino USB driver has been found, start it up
            if len(USBModemList) > 0:
                self.serialBaudRate = 19200
                USBModem = "/dev/" + USBModemList[0]
                self.arduinoSerial = serial.Serial(USBModem, self.serialBaudRate, timeout=0.001)
                self.serialDelay = 0.100
                self.serialTimeout = 0.100
                self.arduinoSerial.flushOutput()
                self.arduinoSerial.flushInput()
                self.arduinoOk = True
                if self.verbose:
                    print "Initializing Arduino USB Serial communication"
                    print "    List of available USB modem devices:",USBModemList
                    print "    Arduino USB device driver:",USBModem
                    print "    Serial baud rate:",self.serialBaudRate
            else:
                self.arduinoOk = False
                if self.verbose:
                    print "Unable to open a serial port to an Arduino - giving up..."
            if self.verbose:
                print '---------------------------------'
                
            # Set the time interval in decimal seconds beyond which communication is considered broken
            self.CommTimeMaxInterval = 10.0
            
            #####################################
            #
            # Initialize joysticks
            
            # Initialize pyGame
            pygame.joystick.init()
            pygame.display.init()
            
            # Allow multiple joysticks
            self.joy = []
            
            # Declare axis displacement vector for an Xbox 360 Controller
            self.displacement = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
            
            # Look for a connected joystick
            if pygame.joystick.get_count() > 0:
                if self.verbose:
                    print 'External Controller (joystick(s)) detected: ',pygame.joystick.get_count()
                self.joystickOk = True
                for i in range(pygame.joystick.get_count()):
                    myjoy = pygame.joystick.Joystick(i)
                    myjoy.init()
                    self.joy.append(myjoy)
                    if self.verbose:
                        print ' Joystick ',i,':',self.joy[i].get_name()
            else:
                self.joystickOk = False
                if self.verbose:
                    print 'No joysticks detected...'
            if self.verbose:
                print '---------------------------------'
            
            #####################################
            
            # Set the time interval in integer milliseconds at which sensor data are requested
            self.SensorRequestInterval = 1000
            
            #####################################
            
            # Wait a bit to let the serial port initialization get handled everywhere
            time.sleep(2.0);
            
            ############################################################################
            
            # Next set up all the graphical widgets and global variables
            self.init_widgets()
            
            # Finally update the widget displays
            self.update_widgets()
            
        def init_widgets(self):
            
            # Define and initialize the variables related to the widgets
    	
    	# Define Time Variables
    	self.ArduinoTime = 0
    	self.CommROVLastTime = 0
    	self.CommJoystickLastTime = 0
    	self.CameraPowerLastTime = 0
    	self.Tool1LastTime = 0
    	self.Tool2LastTime = 0
    	self.Tool3LastTime = 0
    	self.Tool4LastTime = 0
    	self.Tool5LastTime = 0
    	self.Tool6LastTime = 0
    	self.Sensor1LastTime = 0
            self.Sensor2LastTime = 0
    	self.Sensor3LastTime = 0
    	self.Sensor4LastTime = 0
    	self.Sensor5LastTime = 0
    	self.TimeSampleIntervalLastTime = 0
    	self.SensorSampleIntervalLastTime = 0
    	self.ArduinoTimeLastTime = 0
    	
            # Values associated with ROV functions
            self.RHPower = 0
    	self.LHPower = 0
    	self.VPower = 0
    	self.SPower = 0
    	self.CameraPower = 0
    	self.Tool1Power = 0
            self.Tool2Power = 0
    	self.Tool3Power = 0
    	self.Tool4Power = 0
    	self.Tool5Power = 0
    	self.Tool6Power = 0
    	self.TimeSampleInterval = self.SensorRequestInterval
    	self.SensorSampleInterval = self.SensorRequestInterval
    	self.Sensor1 = 0
    	self.Sensor2 = 0
    	self.Sensor3 = 0
    	self.Sensor4 = 0
    	self.Sensor5 = 0
    	self.Temperature = 0
    	self.TemperatureLastTime = 0
    	self.Depth = 0
    	self.DepthLastTime = 0
    
    	### the new variable
    	self.CameraPowerThisTime = BooleanVar()
    	
            # Define the widgets
            
            # Set the window title of the ROV GUI
            self.title('ROV Control Panel')
            
            self.grid()
            
            irow = 0
            
            #####################################
            
            self.labelCommROVString = Tkinter.StringVar()
    	self.labelCommROV = Tkinter.Label(self,textvariable=self.labelCommROVString,anchor="c",relief="ridge",fg="black",bg="red",width=50)
    	self.labelCommROV.grid(column=0,row=irow,columnspan=2,sticky='EW')
    	self.labelCommROVString.set(u"Communication With ROV")
    	
    	#####################################
    	
    	self.labelCommJoystickString = Tkinter.StringVar()
    	self.labelCommJoystick = Tkinter.Label(self,textvariable=self.labelCommJoystickString,anchor="c",relief="ridge",fg="black",bg="red",width=50)
    	self.labelCommJoystick.grid(column=0,row=(irow+1),columnspan=2,sticky='EW')
    	self.labelCommJoystickString.set(u"Control Via Joystick")
    	
    	#####################################
    	
    	self.labelDepthString = Tkinter.StringVar()
    	self.labelDepth = Tkinter.Label(self,textvariable=self.labelDepthString,anchor="c",relief="ridge",fg="black",bg="red",width=25)
    	self.labelDepth.grid(column=2,row=irow,columnspan=1,sticky='EW')
    	self.labelDepthString.set(u"Vehicle Depth: ? meters")
    	
    	#####################################
    	
    	self.labelTemperatureString = Tkinter.StringVar()
    	self.labelTemperature = Tkinter.Label(self,textvariable=self.labelTemperatureString,anchor="c",relief="ridge",fg="black",bg="red",width=25)
    	self.labelTemperature.grid(column=2,row=(irow+1),columnspan=1,sticky='EW')
    	self.labelTemperatureString.set(u"Temperature: ? deg C")
    	
    	#####################################
    	
    	irow = irow + 2
    	
    	self.labelBlankString = Tkinter.StringVar()
    	self.labelBlankString.set(u"----------------------------------------------------------------------")
    	self.labelBlank1 = Tkinter.Label(self,textvariable=self.labelBlankString,anchor="c",fg="black",bg="white",width=25)
    	self.labelBlank1.grid(column=0,row=irow,columnspan=3,sticky='EW')
    	
    	#####################################
    	
    	irow = irow + 1
    	### added variable here
    	self.checkbuttonCameraPower = Tkinter.Checkbutton(self,text=u"Power to Cameras",indicatoron=0,bd=3,selectcolor="lightgreen",command=self.toggleCameraPower,variable=self.CameraPowerThisTime,width=20)
    	self.checkbuttonCameraPower.grid(column=1,row=irow)
    	
    	#####################################
    	
    	irow = irow +1
    	
    	self.labelBlank2 = Tkinter.Label(self,textvariable=self.labelBlankString,anchor="c",fg="black",bg="white",width=25)
    	self.labelBlank2.grid(column=0,row=irow,columnspan=3,sticky='EW')
    	
    	#####################################
    	
    	irow = irow + 1
    	
    	self.scaleThrusterLeftHorizontal = Tkinter.Scale(self,from_=100,to=-100,label="Left Horizontal Thruster",command=self.scaleThrusterLeftHorizontalMove)
    	self.scaleThrusterLeftHorizontal.grid(column=0,row=irow)
    	
    	#####################################
    	
    	self.scaleThrusterVertical = Tkinter.Scale(self,from_=100,to=-100,label="Vertical Thrusters",command=self.scaleThrusterVerticalMove)
    	self.scaleThrusterVertical.grid(column=1,row=irow)
    	
    	#####################################
    	
    	self.scaleThrusterRightHorizontal = Tkinter.Scale(self,from_=100,to=-100,label="Right Horizontal Thruster",command=self.scaleThrusterRightHorizontalMove)
    	self.scaleThrusterRightHorizontal.grid(column=2,row=irow)
    	
    	#####################################
    	
    	irow = irow + 1
    	
            self.scaleThrusterStrafe = Tkinter.Scale(self,from_=-100,to=100,label="Strafe Thrusters",orient="horizontal",command=self.scaleThrusterStrafeMove)
            self.scaleThrusterStrafe.grid(column=1,row=irow)
    	
    	#####################################
    	
    	irow = irow + 1
    	
    	self.labelBlank3 = Tkinter.Label(self,textvariable=self.labelBlankString,anchor="c",fg="black",bg="white",width=25)
    	self.labelBlank3.grid(column=0,row=irow,columnspan=3,sticky='EW')
    	
        #####################################
        
    
        def toggleCameraPower(self):
        	### nested on/off under the new variable decision
        	if self.CameraPowerThisTime:
        	    	if self.verbose:
        	    	    	print 'Cameras On'
        	else:
        	    	if self.verbose:
    	    		print 'Cameras Off'
    		
        #####################################
        
        def scaleThrusterLeftHorizontalMove(self,value):
        	if self.verbose:
    		print 'Left Horizontal Thruster:',value
    	ivalue = int((int(value) * 255) / 100)
    
        #####################################
        
        def scaleThrusterVerticalMove(self,value):
        	if self.verbose:
    		print 'Vertical Thrusters:',value
    	ivalue = int((int(value) * 255) / 100)
            
        #####################################
        
        def scaleThrusterRightHorizontalMove(self,value):
        	if self.verbose:
    		print 'Right Horizontal Thruster:',value
    	ivalue = int((int(value) * 255) / 100)
    	
        #####################################
       
        def scaleThrusterStrafeMove(self,value):
        	if self.verbose:
    		print 'Strafe Thrusters:',value
    	ivalue = int((int(value) * 255) / 100)
    	    
       #####################################
       
        def SerialToArduino(self, message):
        
        	self.arduinoSerial.write(message)
    	timeNow = time.time()
    	
    	time.sleep(self.serialDelay);
    	
        #####################################
        
        def update_widgets(self):
            print "Executing update_widgets()"
    	
    ############################################################################
    
    if __name__ == "__main__":
    
        # Create instance of the ROVCMD class
        app = ROVCMD(None)
    
        # Drop into the main loop to handle events
        app.mainloop()
    
    ############################################################################
    (Changes I made are commented with lines beginning with 3 hashes: ###)
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds