Logo-small

4.2.1 Putting a background picture

User Contributed Notes

daliot.oh (9 April 2011, 6:17 am)

wow, the code and the quality of image is beautiful. This can be a good homework for the reader.

siguctua (21 May 2010, 1:56 am)

An advanced example, which loading a background images from public server,

and changing your background each minute.

 

[

 

[[

| rx str url form |

str := (HTTPSocket httpGet: 'http://www.socwall.com/browse/index.php?wpLimit=1&wpSortby=8') contents.

rx := '.*(http\://.+tb_.+\.jpg).*' asRegex.

url := (rx matches: str)

ifTrue: [

str := (rx subexpression: 2)

copyWithRegex: 'tb_' matchesReplacedWith: '' ]

ifFalse: [ nil ].

url ifNotNil: [

form := ImageReadWriter formFromStream: (HTTPSocket httpGet: url).

World backgroundImage: form layout: #scaled

].

 

]

 

on: Error do: [:ex| ].

1 minute asDelay wait.

] repeat.

 

] newProcess name: 'Random background changer'; priority: Processor userBackgroundPriority; resume

Add a Note

Licensed under Creative Commons BY-NC-SA | Published using Pier |