 |
Linux Format forums Help, discussion, magazine feedback and more
|
| View previous topic :: View next topic |
| Author |
Message |
asmas
Joined: Mon Dec 14, 2009 5:38 pm Posts: 8
|
Posted: Tue Feb 09, 2010 5:38 pm Post subject: Clutter import error |
|
|
I've been trying to do the tutorial in LXF129. When I try to do the first clutter bit:
| Code: |
...
>>> black = clutter.color(0,0,0,255)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'color'
|
I have tried this on Ubuntu & Arch. Does anyone no why this isn't working? |
|
| Back to top |
|
 |
LeeNukes LXF regular

Joined: Sun Jun 21, 2009 9:11 pm Posts: 954 Location: At the bar
|
|
| Back to top |
|
 |
spaceyhase LXF regular
Joined: Mon Jun 30, 2008 1:07 pm Posts: 116
|
Posted: Wed Feb 10, 2010 10:06 am Post subject: |
|
|
It's case sensitive, upper-case 'C'.
| Code: | | black = clutter.Color(0,0,0,255) |
|
|
| Back to top |
|
 |
asmas
Joined: Mon Dec 14, 2009 5:38 pm Posts: 8
|
Posted: Wed Feb 10, 2010 5:15 pm Post subject: |
|
|
| Thanks |
|
| Back to top |
|
 |
asmas
Joined: Mon Dec 14, 2009 5:38 pm Posts: 8
|
Posted: Wed Feb 10, 2010 5:38 pm Post subject: |
|
|
| When you run the listing on the CD, no clutter window appears? |
|
| Back to top |
|
 |
spaceyhase LXF regular
Joined: Mon Jun 30, 2008 1:07 pm Posts: 116
|
Posted: Wed Feb 10, 2010 7:23 pm Post subject: |
|
|
Yeah, big fail this month I reckon as the mag says there should be comments too for extra fun but it's just a dump of what was typed in the mag. It even has carriage returns throughout too... D'oh! If you stick a...
...at the end then the window sticks around long enough to see some action. But then it doesn't behave the same way as typing it in either, overlapping the animations. Erm.
I had some fun with mine. If you run it, hit 'space' in the window and it spins the text around, increments the story to the next one in the feed. It ain't perfect but I got bored
| Code: |
black = clutter.Color(0,0,0,255)
white = clutter.Color(255,255,255,255)
blue = clutter.Color(0,0,255,255)
d=360
story=0
def parseKeyPress(self, event):
global d, story
if event.keyval == clutter.keysyms.q:
clutter.main_quit()
elif event.keyval == clutter.keysyms.space:
group.animate(clutter.LINEAR,500,'rotation-angle-y',d)
d = -d
story = story + 1;
head.set_text(f.entries[story].summary)
body.set_text(f.entries[story].summary)
print 'event processed ', event.keyval
stage = clutter.Stage()
stage.set_size(400,60)
stage.set_color(white)
stage.connect('key-press-event', parseKeyPress)
stage.show_all()
ident=clutter.texture_new_from_file(img)
group=clutter.Group()
head=clutter.Text()
head.set_position(130,5)
head.set_color(blue)
head.set_text(f.entries[story].title)
body=clutter.Text()
body.set_max_length(75)
body.set_position(130,22)
body.set_size(250,100)
body.set_line_wrap(True)
body.set_text(f.entries[story].summary)
group.add(ident, head, body)
group.show_all()
stage.add(group)
clutter.main()
|
What I should have done is use 'Left' and 'Right' to go backwards and then forwards (forwards and then backwards, Eezer is the geezer who loves to muscle in... sorry!) |
|
| Back to top |
|
 |
evilnick Moderator

Joined: Mon Apr 04, 2005 12:47 pm Posts: 151 Location: LXF towers
|
Posted: Sat Feb 13, 2010 2:12 pm Post subject: |
|
|
sorry about the typo - i reckon that fell foul of a spellchecker somewhere.
There was/is a longer version of this, briefly annotated and turned into a proper app. I think I sent it to Mike too late to put on the CD, but I if I can find it I will bung it up here. The code that was included was just the commandline stuff from the magazine, included to help in case of typesetting errors etc. ironically |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|