This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#126 2012-09-03 12:52:17

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: kurt — Scratch file format Python library

amcerbu wrote:

Nice!  Congrats!  I can't wait to check it out!

Me to  smile

Offline

 

#127 2012-09-03 21:34:52

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: kurt — Scratch file format Python library

blob8108 wrote:

Did you see this...?

blob8108 wrote:

MathWizz wrote:

Live updating blocks.  big_smile

It should already do that...  ._.

EDIT: (checks) Yeah, it does for me. What are you using...?

Odd... It didn't before. When did you add it?  tongue


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#128 2012-09-04 10:12:53

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: kurt — Scratch file format Python library

@blob, did you fix the file size image bug?

Offline

 

#129 2012-09-04 11:14:02

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

roijac wrote:

@blob, did you fix the file size image bug?

"file size image bug"?  hmm

I've fixed all the bugs I do know about! I've just tested it on Windows (wow, Python for Windows is a pain) and I'm just about to upload to PyPI  big_smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#130 2012-09-04 11:39:23

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

Well, decompilation could still use some optimisation. And I still haven't compressed the images (although that would make it even slower...). But that's fine! It works.

And darn, uploading to PyPI is difficult!

But it is now uploaded.  big_smile

Head over to the Github project page and follow the readme there  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#131 2012-09-04 14:27:27

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: kurt — Scratch file format Python library

blob8108 wrote:

And I still haven't compressed the images

\
that's what i meant...

also, how do you import the compiler from WARNING: Make sure you take backups of your Scratch projects before saving anything with kurt! I can't accept responsibility for corrupting your files.a python script?  hmm

Last edited by roijac (2012-09-04 15:05:34)

Offline

 

#132 2012-09-04 15:12:05

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

roijac wrote:

blob8108 wrote:

And I still haven't compressed the images

that's what i meant...

It's not a bug; it works perfectly. It just generates slightly larger .sb files than necessary.  tongue

also, how do you import the compiler from a python script?  hmm

"from kurt.compiler import compile" (Similarly for decompile.)

See "cmd_compile" in kurt/compiler.py for the various errors you need to handle  smile

Last edited by blob8108 (2012-09-04 15:12:42)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#133 2012-09-04 15:25:18

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: kurt — Scratch file format Python library

blob8108 wrote:

roijac wrote:

blob8108 wrote:

And I still haven't compressed the images

that's what i meant...

It's not a bug; it works perfectly. It just generates slightly larger .sb files than necessary.  tongue

it IS a bug, and it's not that slightly...

blob8108 wrote:

also, how do you import the compiler from a python script?  hmm

"from kurt.compiler import compile" (Similarly for decompile.)

See "cmd_compile" in kurt/compiler.py for the various errors you need to handle  smile

oh, ok
bit complicated to sort out all morphs from dir(kurt)  big_smile

also, ever thought of threading to speed compilation up?
should help a lot  smile

Last edited by roijac (2012-09-04 15:26:00)

Offline

 

#134 2012-09-04 16:21:41

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

roijac wrote:

bit complicated to sort out all morphs from dir(kurt)  big_smile

Yup  tongue  though the only classes you should really need are Stage, Sprite, ScratchListMorph, Image, Script, Block, maybe Comment, and the two file classes. (I've cheated; these aren't all morphs.  tongue ) Oh, and Watcher-morph-thingy. I don't have the list in front of me...

ever thought of threading to speed compilation up?
should help a lot  smile

I don't think Python threads help /that/ much, actually (because of the "global interpreter lock"?). I think you can use multiprocessing to use multiple processor cores, which might be worth it (although still very complicated to code.)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#135 2012-09-04 16:49:50

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

roijac wrote:

also, how do you import the compiler from a python script?  hmm

It just occured to me that perhaps you were looking for the script that parses block plugin syntax -- that's separate, the method kurt.parse_block_plugin(). It's a bit complicated, though, because you have to call some methods on the returned Script object to fix variables and such -- see how compiler.py does it.


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#136 2012-09-05 02:26:37

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

roijac wrote:

blob8108 wrote:

roijac wrote:


that's what i meant...

It's not a bug; it works perfectly. It just generates slightly larger .sb files than necessary.  tongue

it IS a bug, and it's not that slightly...

You can always just open the project in Scratch and save it again...


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#137 2012-09-05 02:47:07

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: kurt — Scratch file format Python library

A download for Mac yet?  smile

EDIT: Found the download.

Last edited by jji7skyline (2012-09-05 02:49:16)


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#138 2012-09-05 02:54:07

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

jji7skyline wrote:

A download for Mac yet?  smile

EDIT: Found the download.

Yeah, I tested on OS X/Ubuntu/Windows. Should all work fine  smile
[It's easy once you have pip installed...]

Command-line only, though, I'm afraid...  tongue

Last edited by blob8108 (2012-09-05 02:54:24)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#139 2012-09-05 14:11:41

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

jji7skyline wrote:

A download for Mac yet? ...

Did you get it to work?  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#140 2012-09-07 08:11:45

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: kurt — Scratch file format Python library

Blob, can you please write me a quick tutorial on how to do the image import thing?

EDIT: Also, what text/code editor is pictured in the screenshot on the main post? Xcode?

Last edited by Hardmath123 (2012-09-07 08:14:36)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#141 2012-09-07 09:20:11

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

Hardmath123 wrote:

Blob, can you please write me a quick tutorial on how to do the image import thing?

You mean importing multiple images into a project, for a stop motion or something similar? Try this:

1) Make a folder called "stopmotion files/Stage/backgrounds/"
2) Dump your images into the "backgrounds" folder (NB: they get sorted alphabetically). JPGs are preferred, as they're about a zillion times faster. Also make sure they're 480x360 or less.
3) from the directory containing "stopmotion files", run:
    $ kurtc.py compile stopmotion

* you may need to make a blank "notes.txt" file inside "stopmotion files". This is a bug — I fixed it just now. I updated Github and PyPI (Try "sudo pip install --upgrade kurt")

EDIT: Also, what text/code editor is pictured in the screenshot on the main post? Xcode?

Textwranglersmile

Last edited by blob8108 (2012-09-07 09:32:46)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#142 2012-09-07 09:49:25

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: kurt — Scratch file format Python library

I'm currently not on my old Mac (where I have admin privileges), so I can't install. Can I run Kurt with the folder dumped on say my desktop? Also, do I need to download and install the other libraries separately, or do you think you could include them in Kurt?

EDIT: What am I thinking? This Mac doesn't have Scratch in the first place; why am I bothering?  tongue  I'll get back to this once I get to the other Mac.  smile  I've been having one of those days; this morning I took out a juice box, got the straw, and found myself shaking the straw and staring at the juice box...

Last edited by Hardmath123 (2012-09-07 09:51:14)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#143 2012-09-07 10:10:24

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

Hardmath123 wrote:

Can I run Kurt with the folder dumped on say my desktop? Also, do I need to download and install the other libraries separately, or do you think you could include them in Kurt?

You can do that, yes — the script's found under util/kurtc.py.

EDIT: as for the other libraries, you'll have to get those separately, I'm afraid. With the exception of htmlcolor, there's no way I can include all the right versions — especially for PIL, where you ideally need binary distributions for each platform.

I've been having one of those days; this morning I took out a juice box, got the straw, and found myself shaking the straw and staring at the juice box...

...what?!  tongue

Last edited by blob8108 (2012-09-07 10:12:25)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#144 2012-09-07 11:07:37

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: kurt — Scratch file format Python library

blob8108 wrote:

Hardmath123 wrote:

Can I run Kurt with the folder dumped on say my desktop? Also, do I need to download and install the other libraries separately, or do you think you could include them in Kurt?

You can do that, yes — the script's found under util/kurtc.py.

EDIT: as for the other libraries, you'll have to get those separately, I'm afraid. With the exception of htmlcolor, there's no way I can include all the right versions — especially for PIL, where you ideally need binary distributions for each platform.

I've been having one of those days; this morning I took out a juice box, got the straw, and found myself shaking the straw and staring at the juice box...

...what?!  tongue

Yeah. Too much Scratching.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#145 2012-09-07 11:17:42

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

Hardmath123 wrote:

Yeah. Too much Scratching.

Really? That's... bad for you...?  yikes


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#146 2012-09-07 12:02:08

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: kurt — Scratch file format Python library

blob8108 wrote:

Hardmath123 wrote:

Yeah. Too much Scratching.

Really? That's... bad for you...?  yikes

Good for me, bad for anyone around me who has to put up with the occasional lecture on lambda calculus or cellular automata...  tongue  Though I have found myself getting really absent-minded recently, I have too much code/math floating through my brain.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#147 2012-09-07 13:43:23

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

Hardmath123 wrote:

blob8108 wrote:

Hardmath123 wrote:

Yeah. Too much Scratching.

Really? That's... bad for you...?  yikes

Good for me, bad for anyone around me who has to put up with the occasional lecture on lambda calculus or cellular automata...  tongue  Though I have found myself getting really absent-minded recently, I have too much code/math floating through my brain.

But lambda calculus and cellular automata are awesome...  big_smile

I get that sometimes — coding problems can obsess me slightly and distract me from life...

Last edited by blob8108 (2012-09-07 13:49:53)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#148 2012-09-07 13:45:25

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: kurt — Scratch file format Python library

blob8108 wrote:

Hardmath123 wrote:

blob8108 wrote:


Really? That's... bad for you...?  yikes

Good for me, bad for anyone around me who has to put up with the occasional lecture on lambda calculus or cellular automata...  tongue  Though I have found myself getting really absent-minded recently, I have too much code/math floating through my brain.

But lambda calculus and cellular automata are awesome...  big_smile

Not according to anyone in my school.  sad 

I get that sometimes — coding problems can obsess me slightly and distract me from life...

Explaining my situation with the juice box.

[/offtopic]


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#149 2012-09-14 10:27:25

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: kurt — Scratch file format Python library

is there any method to get PIL object from an image?

Offline

 

#150 2012-09-14 16:38:02

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: kurt — Scratch file format Python library

roijac wrote:

is there any method to get PIL object from an image?

kurt Image.get_image() -> Return a PIL.Image.Image object

Last edited by blob8108 (2012-09-14 16:38:12)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

Board footer