Setting/manipulating CSS selectors from Python

Discussion about using Python with libRocket.

Setting/manipulating CSS selectors from Python

Postby DangerOnTheRanger on Sun Jul 01, 2012 11:54 pm

Hi, I'm a happy librocket/Panda3D user, and first of all I'd like to say just what a great experience I've had with librocket so far - it's a really easy to use library :)

Now, my question is, is it possible to create CSS rules that use selectors via Python? Right now, the only solution I can come up with is building up my own style sheet, since I can only seem to set styles on a per-element basis via Python (using Element.style). Unfortunately, it looks like the Python API doesn't expose the InstanceStyleSheetString() method that I would need to do that.

Thanks for your time!
DangerOnTheRanger
 
Posts: 2
Joined: Sun Jul 01, 2012 11:42 pm

Re: Setting/manipulating CSS selectors from Python

Postby DangerOnTheRanger on Fri Aug 10, 2012 9:53 pm

After looking through the librocket documentation a little more, I've come up with some solutions:

  • Create and add an element of type "style" to my dynamically-generated librocket document. I'm not sure if this would work though, and it would require me to dynamically generate a style sheet
  • Write a Python-accessible C++ stub that delegates to InstanceStyleSheetString()

I'll probably attempt the former solution first - it's relatively low-hassle and shouldn't be that hard to implement, CSS generation aside.
DangerOnTheRanger
 
Posts: 2
Joined: Sun Jul 01, 2012 11:42 pm

Re: Setting/manipulating CSS selectors from Python

Postby rabika on Tue Jul 02, 2013 7:41 am

Nice surprise about this shorter form. Can you tell us what it is you are talking/writing about?Has any info. about this shorter form been posted before (and i just missed
rabika
 
Posts: 1
Joined: Tue Jul 02, 2013 7:36 am

Re: Setting/manipulating CSS selectors from Python

Postby corbingravely on Fri Nov 22, 2013 6:52 am

Thank you for sharing this very much helpful though here in this thread. I am just a newbie in the case of python. And my company wants me to learn this thing in about one week. Is it really possible to learn Python in just one week?







------------------------------------------
CORBIN GRAVELY
zipline kit
corbingravely
 
Posts: 1
Joined: Fri Nov 22, 2013 4:45 am


Return to libRocket and Python


cron