Module Theme
[frames | no frames]

Module Theme

The Blender.Window.Theme submodule.


This module provides access to Theme objects in Blender.

 # this is a simplified version of the script
 # shipped with Blender:
 import Blender
 from Blender.Window import Theme, FileSelector

 theme = Theme.Get()[0] # get current theme

 def write_theme(filename):
   "Write the current theme as a bpython script"

   f = file(filename, "w")

   f.write("import Blender")
   f.write("from Blender.Window import Theme")
   f.write("theme = Theme.New('%s')" %

   for tsp in theme.get(): # write each theme space
     command = "\n%s = theme.get('%s')" % (tsp, tsp)
     f.write(command + "\n")
     exec("vars = dir(%s)" % tsp)

     for var in vars: # write each variable from each theme space
       v = "%s.%s" % (tsp, var)
       exec("value = %s" % v)
       f.write("%s = %s\n" % (v, value))

   f.write('\nBlender.Redraw(-1)') # redraw to update the screen

 FileSelector(write_theme, "Save Current Theme", default_fname)

Theme This object gives access to Themes in Blender.

Function Summary
Blender Theme or a list of Blender Themes Get(name)
Get the Theme object(s) from Blender.
Blender Theme New(name, theme)
Create a new Theme object.

Function Details


Get the Theme object(s) from Blender.
name - The name of the Theme object.
It depends on the name parameter:
  • (name): The Theme object called name, None if not found;
  • (): A list with all Theme objects currently in Blender.

           (type=Blender Theme or a list of Blender Themes)

New(name='New Theme', theme='<default>')

Create a new Theme object.
name - The name of the new theme.
theme - a base theme to copy all data from. It defaults to the current one.
           (type=Blender Theme)
A new Blender Theme object.
           (type=Blender Theme)

Generated by Epydoc 2.1 on Mon Jun 13 15:31:22 2005