Forum Archive

Codeshare: (Animated View)

TutorialDoctor

The following code animates a custom view in and out with the press of a button.
For now, the setup is automatic. Once I find a way to neatly distribute pyui files, I will update this code.

I will try to make useful projects for beginners.

Link to Code
Link to Image

brumm

With this script (in the same directory) you can copy your pyui file to the clipboard and then via webinterface in a new github file.

import os
import sys
import clipboard

path = os.getcwd()
files = []
for item in sorted(os.listdir(path)):
  if '.pyui' in item:
    print item,
    files.append(item)
print
print
if len(files) == 1:
  filename = raw_input('Please choose pyui file or press return for [' + files[0] + ']: ') or files[0]
elif len(files) > 1:
  filename = raw_input('Please choose pyui file: ')
else:
  print 'Sorry no pyui file found!'
  sys.exit()

if not '.pyui' in filename:
  filename += '.pyui'

if os.path.exists(filename):
  path += '/' + filename
  file = open(path, 'r')
  clipboard.set(file.read())
  file.close()
  print filename + ' is in clipboard.'
else:
  print "Can't find " + filename
TutorialDoctor

Thank you. I have found another way to do this also last night.

I created two actions that can quickly convert from .pyui to .json and back again.

Github link