'''Desciption:''' [tb] 2011-06-10 This little script shows a daily updated radiation map of Germany. I found this source of information quite serious. '''Code:''' ======tcl # Version 0.1 package require base64 package require http package require Img catch { console show } # http::config -proxyhost -proxyport 8080 set hConn [::http::geturl http://odlinfo.bfs.de/pics/germany.gif] catch {set data [::http::data $hConn]} catch {set imdata [::base64::encode $data]} image create photo IMG -data $imdata pack [label .l -image IMG] -fill both wm title . "Strahlungsverteilung" wm protocol . WM_DELETE_WINDOW {exit} ====== '''Reference Url:''' http://odlinfo.bfs.de/ I had to wait a little on my low end Core2Duo on Ubuntu32 for the image to get created from the base64 encoded data, so be a little patient ;) ---- '''2011-06-28''' [tb] - The URL of the map has changed from ''http://odlinfo.bfs.de/bilder/germany_php.gif'' to ''http://odlinfo.bfs.de/pics/germany.gif''. '''Code changed!''' ---- '''2011-06-28''' [tb] - This version adds a procedure to scale the map on Linux using convert: It was needed because the original map is too big to display on my screen. ======tcl # Version 0.2 package require base64 package require http package require Img catch { console show } # http::config -proxyhost -proxyport 8080 set hConn [::http::geturl http://odlinfo.bfs.de/pics/germany.gif] catch {set data [::http::data $hConn]} catch {set imdata [::base64::encode $data]} image create photo IMG -data $imdata proc scaleImage {percentage} { # Sorry, works only on Linux so far... set cnv [exec which convert] if {[string trim $cnv] != ""} { set infile /tmp/tsb.png set outfile /tmp/tsb_scaled.png IMG write -format PNG $infile catch {exec $cnv $infile -resample $percentage $outfile} err if {$err==""} { image delete IMG image create photo IMG -file $outfile } file delete $infile file delete $outfile } } scaleImage 50% pack [label .l -image IMG] -fill both wm title . "Strahlungsverteilung" wm protocol . WM_DELETE_WINDOW {exit} ====== <>Web Scraping