Image 01
profile-image

mkoehle1

Michael Koehler
Hi,

The screenlet looks pretty good, and I was actually working on the same project myself. However, the default size of the screenlet was a little big for my taste, so I went to change the size, and I found that you only resize the drawing area, not the actual size of the screenlet itself. Also, I was testing it and working with the memory buttons and I received this error:

mike@mike-laptop:~$ Traceback (most recent call last):
File "/usr/local/share/screenlets/Calc/CalcScreenlet.py", line 185, in button_press
if not self.detect_button_action(event.x_root-self.x, event.y_root-self.y):
File "/usr/local/share/screenlets/Calc/CalcScreenlet.py", line 233, in detect_button_action
self.maj_result("m+")
File "/usr/local/share/screenlets/Calc/CalcScreenlet.py", line 295, in maj_result
self.mp()
File "/usr/local/share/screenlets/Calc/CalcScreenlet.py", line 312, in mp
self.m += float(self.get_current())
ValueError: empty string for float()

Otherwise, the screenlet looks great, thanks for the contribution! - Nov 14 2007
HelloWorldScreenlet

Conky by mkoehle1 9 comments

Whise,

I've changed the draw_text() definition to be as follows:

=====================================
def draw_text(self, ctx, value, x, y, width, font, size):
=====================================

The added options are 'width' and 'font', which are variables representing the width of the drawing area and the font type, respectively. Please tell me if there is anything else that you would like me to modify. - Oct 10 2007
HelloWorldScreenlet

Conky by mkoehle1 9 comments

Whise,

Great catch - I hadn't thought about this. I fixed that problem in the draw_text() def, but I didn't add the option to change the text width yet. I'll add that in when I get a chance - Thanks for the pointer. - Oct 09 2007
HelloWorldScreenlet

Conky by mkoehle1 9 comments

Whise,

No, it isn't part of the bzr, I just have it defined below:

=======================================

# This is a user defined function that will tell python how to draw the text onto the background
def draw_text(self, ctx, value, x, y, size):

=======================================

The 10,10,10 represents the x coordinate, y coordinate, and the font size. Therefore, I decided to have the drawing position start 10 pixels from left of the background and 10 pixels down from the top of the background, and I decided to use size 10 font. Thanks for asking for clarification. - Oct 09 2007