| Reply | « Previous Thread | Next Thread » |
|
Hi
![]() It's possible to change the background color of the Topwindow? This is a piece of my code Code:
screen = TopWindow.TopWindow() screen.background_color = 0xff0000 ![]() |
| ikaroweb80 |
| View Public Profile |
| Find all posts by ikaroweb80 |
|
Join Date: Oct 2007
Posts: 2,845
Location: Deva, Romania
Offline
Forum Nokia Champion
|
|
It works for me. Here is what I tried (almost identical to the wiki article):
Code:
import TopWindow from graphics import * import appuifw import e32 height = 29 width = 130 top = 59 left = 110 window = TopWindow.TopWindow() image = Image.new((width,height)) window.add_image(image, (width,height)) #If only width and height are specified, the image will not be resized. #In order to resize the image the final coordinates must be specified as well: #window.add_image(image, (width,height,x2,y2)) window.size = (width, height) window.corner_type = 'square' window.position = (left,top) window.background_color = 0xffa130 def exit(): window.hide() app_lock.signal() app_lock = e32.Ao_lock() window.show() appuifw.app.exit_key_handler = exit app_lock.wait() |
|
Looking at your code, I noticed that this piece of code was in the wrong position:
Code:
screen.add_image(img, (5,5,174,45)) Code:
window.size = (width, height) window.corner_type = 'square' window.position = (left,top) window.background_color = 0xffa130 |
| ikaroweb80 |
| View Public Profile |
| Find all posts by ikaroweb80 |
|
If i add this code to try the topwindow he does not work:
Code:
def topwindow():
height = 29
width = 130
top = 59
left = 30
window = TopWindow.TopWindow()
image = Image.new((width,height))
window.add_image(image, (width,height))
#If only width and height are specified, the image will not be resized.
#In order to resize the image the final coordinates must be specified as well:
#window.add_image(image, (width,height,x2,y2))
window.size = (width, height)
window.corner_type = 'square'
window.position = (left,top)
window.background_color = 0xffa130
window.show()
appuifw.app.menu = [(u"Top",topwindow)]
|
| ikaroweb80 |
| View Public Profile |
| Find all posts by ikaroweb80 |
|
The code Bogdan gives is to change the colour of the window.
Quote:
You will have to work on native extensions for the latter. Kandyfloss V 7.0642.0 18-10-06 RH-51 Nokia 7610 |
| kandyfloss |
| View Public Profile |
| Find all posts by kandyfloss |
|
The code of bogdan.galiceanu works fine, but if i put him into a function does not work.
The topwindow does not appear. |
| ikaroweb80 |
| View Public Profile |
| Find all posts by ikaroweb80 |
|
Quote:
Try to implement this with a selection list. Code:
def top():
height = 29
width = 130
top = 59
left = 30
window = TopWindow.TopWindow()
image = Image.new((width,height))
window.add_image(image, (width,height))
#If only width and height are specified, the image will not be resized.
#In order to resize the image the final coordinates must be specified as well:
#window.add_image(image, (width,height,x2,y2))
window.size = (width, height)
window.corner_type = 'square'
window.position = (left,top)
window.background_color = 0xffa130
window.show()
L = [u'Top']
# create the selection list
index = appuifw.selection_list(choices=L , search_field=1)
# use the result of the selection to trigger some action (here we just print something)
if index == 0:
top()
Kandyfloss V 7.0642.0 18-10-06 RH-51 Nokia 7610 |
| kandyfloss |
| View Public Profile |
| Find all posts by kandyfloss |
|
I've added this line and now works fine!
![]() Code:
image.clear(background) |
| ikaroweb80 |
| View Public Profile |
| Find all posts by ikaroweb80 |
|
I'm try this code:
Code:
def top():
height = 29
width = 130
top = 59
left = 30
window = TopWindow.TopWindow()
image = Image.new((width,height))
window.add_image(image, (width,height))
#If only width and height are specified, the image will not be resized.
#In order to resize the image the final coordinates must be specified as well:
#window.add_image(image, (width,height,x2,y2))
window.size = (width, height)
window.corner_type = 'square'
window.position = (left,top)
window.background_color = 0xffa130
window.show()
L = [u'Top']
# create the selection list
index = appuifw.selection_list(choices=L , search_field=1)
# use the result of the selection to trigger some action (here we just print something)
if index == 0:
top()
![]() I've tried with this code: Code:
r = color[0] g = color[1] b = color[2] border = "%02X%02X%02X" % (r, g, b) border = "0x" + border screen.background_color = eval(bordo) |
| ikaroweb80 |
| View Public Profile |
| Find all posts by ikaroweb80 |
|
Join Date: Oct 2007
Posts: 2,845
Location: Deva, Romania
Offline
Forum Nokia Champion
|
|
|
Quote:
Code:
def tohex(r,g,b): hexchars="0123456789ABCDEF" return "0x"+hexchars[r/16]+hexchars[r%16]+hexchars[g/16]+hexchars[g%16]+hexchars[b/16]+hexchars[b%16]
Last edited by bogdan.galiceanu : 2008-04-16 at 14:08.
|
|
Now i've this error:
Code:
Exception: an integer is required |
| ikaroweb80 |
| View Public Profile |
| Find all posts by ikaroweb80 |
|
Join Date: Oct 2007
Posts: 2,845
Location: Deva, Romania
Offline
Forum Nokia Champion
|
|
In what line do you get that error? If it was in the function I provided, here is an example of how to use it:
Code:
>>>print tohex(12,230,73) 0x0CE649 |
|
Code:
hexchars="0123456789ABCDEF" bord = "0x"+hexchars[r/16]+hexchars[r%16]+hexchars[g/16]+hexchars[g%16]+hexchars[b/16]+hexchars[b%16] screen.background_color = bord rgb color=153 255 0 The hex color converted hex color= 0x99FF00 I've tried with this code: Code:
rgb = r+g+b screen.background_color = rgb
Last edited by ikaroweb80 : 2008-04-16 at 15:18.
|
| ikaroweb80 |
| View Public Profile |
| Find all posts by ikaroweb80 |
|
I've this hex color returned from the function tohex, but when i try to set background.color with this hex he give this error:
Code:
>>> 0xFF33FF Exception: an integer is required |
| ikaroweb80 |
| View Public Profile |
| Find all posts by ikaroweb80 |
|
Quote:
The code from bogdan.galiceanu was correct, but you seem to have skipped over one part: Code:
window.background_color = eval(bord) |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Setting background color for a custom listbox | hubbabubba | General Symbian C++ | 2 | 2008-06-20 10:30 |
| Custom background color for CEikRichTextEditor | vtulai | Symbian User Interface | 2 | 2007-04-05 14:49 |
| Dynamic change background color | s2005 | General Symbian C++ | 0 | 2005-11-03 22:37 |
| Urgent : Changing the background color of the status pane and control pane | prbhat | Symbian User Interface | 1 | 2004-11-25 04:42 |
| CEikEdwin with background color | opsaxell | Symbian User Interface | 0 | 2004-06-02 10:37 |