i'm too lazy to make one of these, but i hope someone makes one that doesn't look like a hand...
and, you are the first to put this function in a *dashboard* widget, but konfabulator had widgets that do this and much more... oh and people never tried to charge folks for their widgets.
tip for dev: you have problems with escaping applescript becuase you take way too many lines to get what you need. both your applescript calls could be done in one line. if you pay me $7 I'll send you those two lines of code. but seriously, just use:
"\tell application \"iTunes\" to (((rating of current track) / 20) as integer) as string";
"\tell application \"iTunes\" to set rating of current track to "+(r * 20);
best of luck