M30W Programming Forum

M30W is a text-based version of Scratch

You are not logged in.

Announcement

This is the development forum for M30W (also known as Emerald, do not confuse with Emerald Programming Language).
Our Non-development forums are available here

M30W(Emerald) 0.3 is out! (Download) Requires Python 2.6 or higher.
Opal 0.3(A better command line M30W) is out! (Download) Requires Python 2.6 or higher.
M30W 0.3.6 GUI barebones (Download) Requires Python 2.6 or higher and wxPython
Diamond-2 RED2 GUI Barebones (Fancy M30W editor) s out! (Download) Requires .NET Framework 3.5 or higher, does not require Python
M30W++ GUI barebones (Java M30W) Alpha 1 is out! (Download) Requires Java.


Gershmer.net, our hosting, will close in February 2011. We have not fully decided what to do with our hosting after that, but we will tell you when we decide.

Adverts

Adverts

#1 2009-11-16 00:05:29

Gershmer
Admin
From: Newton Centre, Massachusetts
Registered: 2009-10-08
Posts: 515
Website

Graphics

We may actually be able to have sprites sooner than thought.

This simple .py file can display a .png file


Pretty cool, huh?

A quick Python-ing.

Display real images (not GUI pieces, ex menu bar, window, text box) in Python using PyGame.

Code:

import pygame   #loads the pygame module

w = [width] #sets image displaying area  width

h = [height] #sets  image displaying area height

screen = pygame.display.set_mode(([width], [height]))  #make and display window

graphic = pygame.image.load("[image name + file extension]").convert()

screen.blit(graphic, (0, 0)) #Display image at 0, 0

pygame.display.flip()   #Update screen

running = 1

while running:          #Loop this

   for event in pygame.event.get():    #get user input

      if event.type == pygame.QUIT:    #if user clicks the close X

           running = 0                 #make running 0 to break out of loop

 

   screen.blit(graphic, (0, 0)) #Display image at 0, 0

 

   pygame.display.flip()   #Update screen

Make it a  no command line ☺ ☺ ☺ .pyw file

Oh yeah, if something in my code looks like this: [value], substitute the value for it, without brackets...

One more thing. You can't run the file through IDLE as "Run Module (F5)" You have to click on the .pyw file and let it run through itself. (Not in IDLE)


http://card.ly/images/vcard-green-small.png

Offline

 

2009-11-16 00:05:29

AdBot
Advertisements

#2 2009-11-16 09:17:44

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: Graphics

One more thing: Why doesn't it open in the centre of the screen?


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#3 2009-11-16 17:35:25

Magnie
> I am Ninja! <
From: Polaris, the planet
Registered: 2009-10-08
Posts: 321
Website

Re: Graphics

Cause 0 starts at the top - left corner, not the center, it isn't like Scratch. :/


- I speak IF Common -
  ~ Magnie Mozios ~

Offline

 

#4 2009-11-16 18:01:33

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: Graphics

Yeah, I know this. In C# it's also like this. I was just wondering why the WINDOW doesn't open in the centre of the screen... Maybe it's possible to change it, as well as the title...


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#5 2009-11-16 22:59:56

Gershmer
Admin
From: Newton Centre, Massachusetts
Registered: 2009-10-08
Posts: 515
Website

Re: Graphics

Another example... PyGame with 2 images, if you had trouble understanding syntax



@filo5 Title is definitely changeable. I'll look it up right now.


http://card.ly/images/vcard-green-small.png

Offline

 

#6 2009-11-16 23:05:47

Gershmer
Admin
From: Newton Centre, Massachusetts
Registered: 2009-10-08
Posts: 515
Website

Re: Graphics

OK, title change.

Code:

# change the window title from default to your own
pygame.display.set_caption("[title]")

Easy enough.

As always, when I put something in brackets, like this: [value], substitute [value] for your value, and without brackets, example:

Code:

# change the window title from default to your own
pygame.display.set_caption("Emerald Player 0.1")

I don't know why I thought I had to comment my code, there.  I was explaining it anyway.


http://card.ly/images/vcard-green-small.png

Offline

 

#7 2009-11-17 07:36:01

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: Graphics

To make people think it's pasted from code... Anyway, that'd be for background. But we need sprites. I'll read through pygame tutorials. I wonder why there's no Visual Studio thing for Python...


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#8 2009-11-17 15:21:15

Magnie
> I am Ninja! <
From: Polaris, the planet
Registered: 2009-10-08
Posts: 321
Website

Re: Graphics

Yes, I wish there was an easier environment to use... I'm thinking about creating a separate project just like Emerald but we try different things on it, like the saving and loading, I have a new technique for that. ^.^


- I speak IF Common -
  ~ Magnie Mozios ~

Offline

 

#9 2009-11-19 16:53:12

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Graphics

Why dont we do a code version of emerald, and use diamond (Emerald+) for Visual Emerald? Just a crazy idea


I am A M30Wr.
I always get the last word.

Offline

 

#10 2009-11-20 19:28:47

Magnie
> I am Ninja! <
From: Polaris, the planet
Registered: 2009-10-08
Posts: 321
Website

Re: Graphics

I don't know...


- I speak IF Common -
  ~ Magnie Mozios ~

Offline

 

#11 2009-11-20 20:26:01

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Graphics

just random idea. probly no point in it though.


I am A M30Wr.
I always get the last word.

Offline

 

#12 2009-11-29 09:48:49

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: Graphics

An interesting discovery: there IS an IDE for Python. It's called PyDev (plugin for Eclipse). But Eclipse itself is a whack. You need to wait 5 minutes to start up, next two for the new project wizard to come up, and finally, if you think it's ready, it has 30% chance to crash!

There's also Python for .NET based on .NET - IronPython.


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#13 2009-11-29 13:39:26

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Graphics

wow... that sounds pretty bad.


I am A M30Wr.
I always get the last word.

Offline

 

#14 2009-11-29 14:14:25

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: Graphics

Well, not really. New stable ("Galileo") is... Stable. It opens pretty quick and everything seems to be OK. I'm trying to learn Python, BTW.


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#15 2009-11-30 15:48:37

Magnie
> I am Ninja! <
From: Polaris, the planet
Registered: 2009-10-08
Posts: 321
Website

Re: Graphics

Eclipse opens up in 1 minute and has extremely low lag for me, it's just the other windows won't open up for Emerald.


- I speak IF Common -
  ~ Magnie Mozios ~

Offline

 

#16 2009-11-30 16:36:05

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: Graphics

Have you ever heard about creating a project, and including Emerald's code into the project?


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#17 2009-11-30 16:36:22

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: Graphics

Hold on, have you got PyDev?


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#18 2009-12-01 20:32:51

floppy_gunk
I Am Your Father.
From: Earth, The Milky Way (I think)
Registered: 2009-10-08
Posts: 186
Website

Re: Graphics

Gershmer wrote:

We may actually be able to have sprites sooner than thought.

I have a feeling that we will have sprites in version 0.5.


Big Bob bites black bugs, but black bugs bite Big Bob back.

Offline

 

#19 2009-12-02 02:46:39

Magnie
> I am Ninja! <
From: Polaris, the planet
Registered: 2009-10-08
Posts: 321
Website

Re: Graphics

Filo: Idk... xD

Floppy: Can we try to get 0.4 done before Christmas and make 0.5 by the end of January? ( I'm so tired of waiting for someone to do something... )


- I speak IF Common -
  ~ Magnie Mozios ~

Offline

 

#20 2009-12-03 00:33:24

Gershmer
Admin
From: Newton Centre, Massachusetts
Registered: 2009-10-08
Posts: 515
Website

Re: Graphics

Magnie wrote:

( I'm so tired of waiting for someone to do something... )

There is Opal 0.1... link


http://card.ly/images/vcard-green-small.png

Offline

 

#21 2009-12-03 01:35:31

Magnie
> I am Ninja! <
From: Polaris, the planet
Registered: 2009-10-08
Posts: 321
Website

Re: Graphics

Yes, I know. I might take Opal and re-edit it for 0.4


- I speak IF Common -
  ~ Magnie Mozios ~

Offline

 

Adverts

Board footer

Powered by FluxBB
Hosted by PunBB-Hosting