Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. f = open ('file')
  2. xml = open ('background-1.xml', 'at')
  3.  
  4. prev = None
  5. for img in f:
  6.     img = img.strip ()
  7.     if prev is not None:
  8.         xml.write ('''\
  9.  <static>
  10.    <duration>595.0</duration>
  11.    <file>''' + prev + '''</file>
  12.  </static>
  13. ''')
  14.    
  15.         xml.write ('''\
  16.  <transition>
  17.    <duration>5.0</duration>
  18.    <from>''' + prev + '''</from>
  19.    <to>''' + img + '''</to>
  20.  </transition>
  21. ''')
  22.     else:
  23.         first = img
  24.    
  25.     prev = img
  26.    
  27. xml.write ('''\
  28.  <transition>
  29.    <duration>5.0</duration>
  30.    <from>''' + img + '''</from>
  31.    <to>''' + first + '''</to>
  32.  </transition>
  33. ''')
  34.  
  35. xml.close ()
  36. f.close ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement