Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Clutter import error

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
asmas



Joined: Mon Dec 14, 2009 5:38 pm
Posts: 8

PostPosted: Tue Feb 09, 2010 5:38 pm    Post subject: Clutter import error Reply with quote

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
View user's profile Send private message Send e-mail
LeeNukes
LXF regular


Joined: Sun Jun 21, 2009 9:11 pm
Posts: 954
Location: At the bar

PostPosted: Tue Feb 09, 2010 10:00 pm    Post subject: Reply with quote

Is something missing a set_color?
_________________
Join GiffGaff and get 5 free credit
Back to top
View user's profile Send private message
spaceyhase
LXF regular


Joined: Mon Jun 30, 2008 1:07 pm
Posts: 116

PostPosted: Wed Feb 10, 2010 10:06 am    Post subject: Reply with quote

It's case sensitive, upper-case 'C'.

Code:
black = clutter.Color(0,0,0,255)
Back to top
View user's profile Send private message
asmas



Joined: Mon Dec 14, 2009 5:38 pm
Posts: 8

PostPosted: Wed Feb 10, 2010 5:15 pm    Post subject: Reply with quote

Thanks
Back to top
View user's profile Send private message Send e-mail
asmas



Joined: Mon Dec 14, 2009 5:38 pm
Posts: 8

PostPosted: Wed Feb 10, 2010 5:38 pm    Post subject: Reply with quote

When you run the listing on the CD, no clutter window appears?
Back to top
View user's profile Send private message Send e-mail
spaceyhase
LXF regular


Joined: Mon Jun 30, 2008 1:07 pm
Posts: 116

PostPosted: Wed Feb 10, 2010 7:23 pm    Post subject: Reply with quote

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...

Code:
clutter.main()


...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 Wink

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
View user's profile Send private message
evilnick
Moderator


Joined: Mon Apr 04, 2005 12:47 pm
Posts: 151
Location: LXF towers

PostPosted: Sat Feb 13, 2010 2:12 pm    Post subject: Reply with quote

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 user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
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
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast