can anyone tell me if the text entry widget is exposed via the xbmcgui module in python? *i took a look at the python.txt file mentioned in an earlier message but didn't see anything about it in there. *if you're wondering which widget i'm talking about, it is the location search widget used in the weather settings screen.
this would be very handy to have available. *i'd like to use something like it to be able configure the hostname, database, user, password for accessing the mythtv database. *also, it would be handy in a schedule search screen for searching the mythtv television schedule or recorded shows.
if it isn't possible, then i think i might try to write a custom window in python to be able to enter text.
i requested it, so i hope darkie will hear me http://www.xboxmediaplayer.de/forums/non-cgi/emoticons/wink.gif
but for now it's not included
alx5962, i heard you :)
and keyboard support in python will be added. i'll try to do it today.
alx5962, i heard you :)
and keyboard support in python will be added. i'll try to do it today.
darkie you are my idol :lol:
as we are currently talking about features in this thread, will there be a 'list' control? there is already a select dialog but i wanted to add a list to my normal window.
i could of course create one from scratch, but if it's on the todo list.. :).
just added your keyboard to cvs
example of how to use it
import xbmc
keyboard = xbmc.keyboard('name')
keyboard.domodal()
if (keyboard.isconfirmed())
*print keyboard.gettext()
else
*print 'user canceled'
as we are currently talking about features in this thread, will there be a 'list' control? there is already a select dialog but i wanted to add a list to my normal window.
i could of course create one from scratch, but if it's on the todo list.. .
just added one to cvs for you
check windowexample.py on how you can use it
seeing as easter seems to have come early over here, a function like:
getlabellength(font,string)
that would return the length of a text label using this font with this text. alternately, a 'text box' that automatically split lines at a certain (pixel) width (but only at specific characters eg spaces) and returned the total lines used would be good.
would make life much easier writing for multiple resolutions and laying out text.
seeing as easter seems to have come early over here, a function like:
getlabellength(font,string)
that would return the length of a text label using this font with this text. alternately, a 'text box' that automatically split lines at a certain (pixel) width (but only at specific characters eg spaces) and returned the total lines used would be good.
would make life much easier writing for multiple resolutions and laying out text.
that would return the length of a text label using this font with this text. alternately, a 'text box' that automatically split lines at a certain (pixel) width (but only at specific characters eg spaces) and returned the total lines used would be good.
a textbox has been added 3 days ago or so,
see readme_python.txt for details
getlabellength(font,string)
that would return the length of a text label using this font with this text. alternately, a 'text box' that automatically split lines at a certain (pixel) width (but only at specific characters eg spaces) and returned the total lines used would be good.
hmmm... i was just going to start figuring out how many horizontal pixels each character in font14 and font16 takes up. i already wrote a function to split a string into multiple lines at white space characters but it does it based on string length instead of actual pixel length. having a function like the one you mentioned above would definitely be handy... or a function that returned font attributes (e.g. pixel height of font, base line pixel height, character pixel widths, etc.) would be useful. then python utility functions can be written to do whatever calculations are needed.
here is a class that i put together by trial and error for handling font14 character widths... i haven't done other fonts yet.
class fontattr:
def ( self, name ):
if name == "font14":
self.initfont14()
else:
raise gui.exception, "unsupported font '" + name + "'"
self.name = name
def initfont14( self ):
self.height = 14
self.width = [ \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
# sp ! " # $ % & '
0, 0, 6, 6, 8, 14, 10, 19, 13, 4,
#( ) * + , - . / 0 1
7, 7, 24, 14, 6, 7, 6, 7, 10, 10,
#2 3 4 5 6 7 8 9 : ;
10, 10, 10, 10, 10, 10, 10, 10, 7, 7,
#< = > ? @ a b c d e
14, 14, 14, 9, 17, 11, 11, 11, 13, 11,
#f g h i j k l m n o
10, 13, 13, 7, 8, 11, 9, 15, 13, 13,
#p q r s t u v w x y
10, 13, 12, 11, 11, 12, 11, 17, 11, 11,
#z [ \ ] ^ _ ` a b c
11, 7, 7, 7, 14, 10, 10, 10, 11, 9,
#d e f g h i j k l m
11, 10, 6, 11, 11, 4, 5, 9, 4, 16,
#n o p q r s t u v w
11, 10, 11, 11, 7, 8, 6, 11, 9, 14,
#x y z { | } ~
9, 9, 8, 9, 7, 9, 14
]
def getwidth( self, c ):
return self.width[ord(c)]
jastorino
2004-04-11, 01:21
i have just started using python and i am trying to use the controlbutton widget. i noticed that when i add a button, it doesn't look like a button, it simply looks like a label blending into the background until i select it, at which time it looks like a button.
i am simply using "controlbutton(posx, posy, sizex, sizey, font)"
can someone suggest the right way of making the button visible when not selected?
also, i noticed in this post that there were changes made to python and added to cvs as recent as april 6th, but the only version i found in cvs is approx 2 months old (ver 1.3).
is that the latest up to date version?
thanks for your help.
your default button color is probably the same as your background color therefore it blends in possibly.
have you tried supplying a focus texture and a no focus texture? here is the relevant info from the python_readme.txt.
xbmcgui.controlbutton(int x, int y, int width, int height[, string text, string texturefocus, string texture nofocus])
the texturefocus and texturenofocus parameters will probably need to be full paths to the texture files unless you are reusing the textures in texture.xpr (i.e. q:\skin\mediacenter\media\buttonfocus.png). you can call xbmc.getskindir() instead of hard coding "mediacenter" in the path if you like...