TypeError: unsupported operand type(s) for -: 'tuple' and 'tuple'

2006-03-16 Thread Peter Bismuti
Strange, I don't get this error when using pure Python, only when using PyQt. 

Can anyone tell me what is going on here? Thanks!





File /acct/pjb9508/RAT/Scripts/PyQt/RatDialog.py, line 30, in NewClipButton_clicked
 self.rat.planeClip(self.o,SQUARE+str(self.squareCounter),width,origin)
 File /acct/pjb9508/RAT/Scripts/PyQt/rat.py, line 12, in planeClip
 plane1[1] = origin[1]-width
TypeError: unsupported operand type(s) for -: 'tuple' and 'tuple'
-- Peter Bismuti
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'Dialog.ui'
#
# Created: Thu Mar 16 09:42:22 2006
#  by: The PyQt User Interface Compiler (pyuic) 3.13
#
# WARNING! All changes made in this file will be lost!


from qt import *


class Dialog(QDialog):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
QDialog.__init__(self,parent,name,modal,fl)

if not name:
self.setName(Dialog)


DialogLayout = QGridLayout(self,1,1,11,6,DialogLayout)

layout14 = QVBoxLayout(None,0,6,layout14)

layout13 = QHBoxLayout(None,0,6,layout13)

self.ClipListView = QListView(self,ClipListView)
self.ClipListView.addColumn(self.__tr(Column 1))
layout13.addWidget(self.ClipListView)

self.ClipTextEdit = QTextEdit(self,ClipTextEdit)
layout13.addWidget(self.ClipTextEdit)
layout14.addLayout(layout13)

layout10 = QHBoxLayout(None,0,6,layout10)

layout9 = QVBoxLayout(None,0,6,layout9)

layoutWidth = QHBoxLayout(None,0,6,layoutWidth)

self.WidthLabel = QLabel(self,WidthLabel)
layoutWidth.addWidget(self.WidthLabel)

self.WidthLineEdit = QLineEdit(self,WidthLineEdit)
layoutWidth.addWidget(self.WidthLineEdit)
layout9.addLayout(layoutWidth)

layout5 = QVBoxLayout(None,0,6,layout5)

self.OriginLabel = QLabel(self,OriginLabel)
self.OriginLabel.setAlignment(QLabel.WordBreak | QLabel.AlignCenter)
layout5.addWidget(self.OriginLabel)

layoutX = QHBoxLayout(None,0,6,layoutX)

self.XLabel = QLabel(self,XLabel)
layoutX.addWidget(self.XLabel)

self.XLineEdit = QLineEdit(self,XLineEdit)
layoutX.addWidget(self.XLineEdit)
layout5.addLayout(layoutX)

layoutY = QHBoxLayout(None,0,6,layoutY)

self.YLabel = QLabel(self,YLabel)
layoutY.addWidget(self.YLabel)

self.YLineEdit = QLineEdit(self,YLineEdit)
layoutY.addWidget(self.YLineEdit)
layout5.addLayout(layoutY)

layoutZ = QHBoxLayout(None,0,6,layoutZ)

self.ZLabel = QLabel(self,ZLabel)
layoutZ.addWidget(self.ZLabel)

self.ZLineEdit = QLineEdit(self,ZLineEdit)
layoutZ.addWidget(self.ZLineEdit)
layout5.addLayout(layoutZ)
layout9.addLayout(layout5)
layout10.addLayout(layout9)

self.ButtonGroup = QButtonGroup(self,ButtonGroup)

self.CircleRadioButton = QRadioButton(self.ButtonGroup,CircleRadioButton)
self.CircleRadioButton.setGeometry(QRect(20,50,56,21))

self.SquareRadioButton = QRadioButton(self.ButtonGroup,SquareRadioButton)
self.SquareRadioButton.setGeometry(QRect(20,20,64,21))
self.SquareRadioButton.setChecked(1)
layout10.addWidget(self.ButtonGroup)
layout14.addLayout(layout10)

layout11 = QHBoxLayout(None,0,6,layout11)

self.NewClipButton = QPushButton(self,NewClipButton)
layout11.addWidget(self.NewClipButton)

self.DeleteClipButton = QPushButton(self,DeleteClipButton)
layout11.addWidget(self.DeleteClipButton)

self.CloseButton = QPushButton(self,CloseButton)
layout11.addWidget(self.CloseButton)
layout14.addLayout(layout11)

DialogLayout.addLayout(layout14,0,0)

self.languageChange()

self.resize(QSize(340,427).expandedTo(self.minimumSizeHint()))
self.clearWState(Qt.WState_Polished)

self.connect(self.NewClipButton,SIGNAL(clicked()),self.NewClipButton_clicked)
self.connect(self.DeleteClipButton,SIGNAL(clicked()),self.DeleteClipButton_clicked)
self.connect(self.CloseButton,SIGNAL(clicked()),self.CloseButton_clicked)


def languageChange(self):
self.setCaption(self.__tr(RAT))
self.ClipListView.header().setLabel(0,self.__tr(Column 1))
self.ClipListView.clear()
item = QListViewItem(self.ClipListView,None)
item.setText(0,self.__tr(New Item))

self.WidthLabel.setText(self.__tr(bWidth/Radius/b))
self.OriginLabel.setText(self.__tr(bOrigin/b))
self.XLabel.setText(self.__tr(bX/b))
self.YLabel.setText(self.__tr(bY/b))
self.ZLabel.setText(self.__tr(bZ/b))
self.ButtonGroup.setTitle(self.__tr(Clip Type))
self.CircleRadioButton.setText(self.__tr(Circle))
self.SquareRadioButton.setText(self.__tr(Square))
self.NewClipButton.setText(self.__tr(New

TypeError: unsupported operand type(s) for -: 'tuple' and 'tuple'

2006-03-16 Thread Peter Bismuti
Can anyone explain this error message? 

Traceback (most recent call last):
 File /acct/pjb9508/RAT/Scripts/PyQt/RatDialog.py, line 30, in NewClipButton_clicked
 self.rat.planeClip(self.o,SQUARE+str(self.squareCounter),width,origin)
 File /acct/pjb9508/RAT/Scripts/PyQt/rat.py, line 12, in planeClip
 plane1[1] = origin[1]-width
TypeError: unsupported operand type(s) for -: 'tuple' and 'tuple'
-- Peter Bismuti
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'Dialog.ui'
#
# Created: Thu Mar 16 09:42:22 2006
#  by: The PyQt User Interface Compiler (pyuic) 3.13
#
# WARNING! All changes made in this file will be lost!


from qt import *


class Dialog(QDialog):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
QDialog.__init__(self,parent,name,modal,fl)

if not name:
self.setName(Dialog)


DialogLayout = QGridLayout(self,1,1,11,6,DialogLayout)

layout14 = QVBoxLayout(None,0,6,layout14)

layout13 = QHBoxLayout(None,0,6,layout13)

self.ClipListView = QListView(self,ClipListView)
self.ClipListView.addColumn(self.__tr(Column 1))
layout13.addWidget(self.ClipListView)

self.ClipTextEdit = QTextEdit(self,ClipTextEdit)
layout13.addWidget(self.ClipTextEdit)
layout14.addLayout(layout13)

layout10 = QHBoxLayout(None,0,6,layout10)

layout9 = QVBoxLayout(None,0,6,layout9)

layoutWidth = QHBoxLayout(None,0,6,layoutWidth)

self.WidthLabel = QLabel(self,WidthLabel)
layoutWidth.addWidget(self.WidthLabel)

self.WidthLineEdit = QLineEdit(self,WidthLineEdit)
layoutWidth.addWidget(self.WidthLineEdit)
layout9.addLayout(layoutWidth)

layout5 = QVBoxLayout(None,0,6,layout5)

self.OriginLabel = QLabel(self,OriginLabel)
self.OriginLabel.setAlignment(QLabel.WordBreak | QLabel.AlignCenter)
layout5.addWidget(self.OriginLabel)

layoutX = QHBoxLayout(None,0,6,layoutX)

self.XLabel = QLabel(self,XLabel)
layoutX.addWidget(self.XLabel)

self.XLineEdit = QLineEdit(self,XLineEdit)
layoutX.addWidget(self.XLineEdit)
layout5.addLayout(layoutX)

layoutY = QHBoxLayout(None,0,6,layoutY)

self.YLabel = QLabel(self,YLabel)
layoutY.addWidget(self.YLabel)

self.YLineEdit = QLineEdit(self,YLineEdit)
layoutY.addWidget(self.YLineEdit)
layout5.addLayout(layoutY)

layoutZ = QHBoxLayout(None,0,6,layoutZ)

self.ZLabel = QLabel(self,ZLabel)
layoutZ.addWidget(self.ZLabel)

self.ZLineEdit = QLineEdit(self,ZLineEdit)
layoutZ.addWidget(self.ZLineEdit)
layout5.addLayout(layoutZ)
layout9.addLayout(layout5)
layout10.addLayout(layout9)

self.ButtonGroup = QButtonGroup(self,ButtonGroup)

self.CircleRadioButton = QRadioButton(self.ButtonGroup,CircleRadioButton)
self.CircleRadioButton.setGeometry(QRect(20,50,56,21))

self.SquareRadioButton = QRadioButton(self.ButtonGroup,SquareRadioButton)
self.SquareRadioButton.setGeometry(QRect(20,20,64,21))
self.SquareRadioButton.setChecked(1)
layout10.addWidget(self.ButtonGroup)
layout14.addLayout(layout10)

layout11 = QHBoxLayout(None,0,6,layout11)

self.NewClipButton = QPushButton(self,NewClipButton)
layout11.addWidget(self.NewClipButton)

self.DeleteClipButton = QPushButton(self,DeleteClipButton)
layout11.addWidget(self.DeleteClipButton)

self.CloseButton = QPushButton(self,CloseButton)
layout11.addWidget(self.CloseButton)
layout14.addLayout(layout11)

DialogLayout.addLayout(layout14,0,0)

self.languageChange()

self.resize(QSize(340,427).expandedTo(self.minimumSizeHint()))
self.clearWState(Qt.WState_Polished)

self.connect(self.NewClipButton,SIGNAL(clicked()),self.NewClipButton_clicked)
self.connect(self.DeleteClipButton,SIGNAL(clicked()),self.DeleteClipButton_clicked)
self.connect(self.CloseButton,SIGNAL(clicked()),self.CloseButton_clicked)


def languageChange(self):
self.setCaption(self.__tr(RAT))
self.ClipListView.header().setLabel(0,self.__tr(Column 1))
self.ClipListView.clear()
item = QListViewItem(self.ClipListView,None)
item.setText(0,self.__tr(New Item))

self.WidthLabel.setText(self.__tr(bWidth/Radius/b))
self.OriginLabel.setText(self.__tr(bOrigin/b))
self.XLabel.setText(self.__tr(bX/b))
self.YLabel.setText(self.__tr(bY/b))
self.ZLabel.setText(self.__tr(bZ/b))
self.ButtonGroup.setTitle(self.__tr(Clip Type))
self.CircleRadioButton.setText(self.__tr(Circle))
self.SquareRadioButton.setText(self.__tr(Square))
self.NewClipButton.setText(self.__tr(New))
self.DeleteClipButton.setText(self.__tr(Delete

Re: TypeError: unsupported operand type(s) for -: 'tuple' and 'tuple'

2006-03-16 Thread Jay Parlar

On Mar 16, 2006, at 3:14 PM, Peter Bismuti wrote:
 Can anyone explain this error message? 

  Traceback (most recent call last):
    File /acct/pjb9508/RAT/Scripts/PyQt/RatDialog.py, line 30, in  
 NewClipButton_clicked
       
 self.rat.planeClip(self.o,SQUARE+str(self.squareCounter),width,origin 
 )
    File /acct/pjb9508/RAT/Scripts/PyQt/rat.py, line 12, in planeClip
      plane1[1] = origin[1]-width
  TypeError: unsupported operand type(s) for -: 'tuple' and 'tuple'



It looks like origin[1] and 'width' are both tuples. Substraction is  
not defined on tuples. That's what the error message is saying at  
least:

TypeError: unsupported operand type(s) for -: -This means that the  
'-' operator received some bad types, types it doesn't know how to work  
with

'tuple' and 'tuple' - This means the two types it received were both  
tuples.

Jay P.

-- 
http://mail.python.org/mailman/listinfo/python-list