I am trying to script Calligra Sheets (formerly KSpread) with python. I have gotten some of the included example scripts to run so I know python scripting is running.

I found the following snippet on their website:

import KSpread
sheet = KSpread.view().sheet()
# swap text of B5 and C6
t1 = sheet.text("B5")
t2 = sheet.text(6,3)
sheet.setText("B5", t2)
sheet.setText(6, 3, t1)
# swap value of D7 and E8
v1 = sheet.value("D7")
v2 = sheet.value(8,5)
sheet.setValue("D7", v2)
sheet.setValue(8, 5, v1)

Error: 'str' object has no attribute 'text'
File "file:///usr/share/kde4/apps/sheets/scripts/extensions/myswap.py", line 4, in <module>


This error message appeared in a dialog box.

I've taught myself some Python but I don't understand what is happening here. Shouldn't t1 be a sheet object? What would cause it to be a str instead?

Thanks,  Jim



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to