Hello
I can't set the "bold" style to a label's font : (with-ltk () (make-instance 'label :text "..." :font '(:weight :bold) :pack '(:side :left)))
(I've a similar error with 3 instead of :bold for example)
-> "Tcl/Tk error: expected integer but got "BOLD)"
How does it work ?
Thank you
Sylvain
Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ? Je crée ma boîte mail www.laposte.net
On Sun, Jan 08, 2012 at 01:59:38AM +0100, syll-dev@laposte.net wrote:
Hello
Hi!
I can't set the "bold" style to a label's font : (with-ltk () (make-instance 'label :text "..." :font '(:weight :bold) :pack '(:side :left)))
try [...] :font "sans 11 bold" [...]
please see font(3tk) for explanation about the way tk manage font description.
Bye! C.
Message du 10/01/12 19:23 De : "cage" A : ltk-user@common-lisp.net Copie à : Objet : Re: [ltk-user] Bold font for label
On Sun, Jan 08, 2012 at 01:59:38AM +0100, syll-dev@laposte.net wrote:
Hello
Hi!
I can't set the "bold" style to a label's font : (with-ltk () (make-instance 'label :text "..." :font '(:weight :bold) :pack '(:side :left)))
try [...] :font "sans 11 bold" [...]
please see font(3tk) for explanation about the way tk manage font description.
Thank you for your answer :) . Is it possible to get the font used by a component and just modify it ? I would like to get the same font but in bold style.
Thank you
Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ? Je crée ma boîte mail www.laposte.net
On Thu, Jan 12, 2012 at 02:09:08AM +0100, syll-dev@laposte.net wrote:
[...]
try [...] :font "sans 11 bold" [...]
please see font(3tk) for explanation about the way tk manage font description.
Thank you for your answer :) .
You're welcome! :)
Is it possible to get the font used by a component and just modify it ? I would like to get the same font but in bold style.
Good question but i have no answer good enough! :)
I suggest to save the name (and the size if you wish) of the font elsewhere and reconfigure the widget with the new weight using the configure function.
Bye! C.
Message du 12/01/12 20:23 De : "cage" A : ltk-user@common-lisp.net Copie à : Objet : Re: [ltk-user] Bold font for label
On Thu, Jan 12, 2012 at 02:09:08AM +0100, syll-dev@laposte.net wrote:
[...]
try [...] :font "sans 11 bold" [...]
please see font(3tk) for explanation about the way tk manage font description.
Thank you for your answer :) .
You're welcome! :)
Is it possible to get the font used by a component and just modify it ? I would like to get the same font but in bold style.
Good question but i have no answer good enough! :)
I suggest to save the name (and the size if you wish) of the font elsewhere and reconfigure the widget with the new weight using the configure function.
I know how to create a font and I could use this to modify/reuse it, but I don't know how to get the font (and its properties) used by a component :( .
Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ? Je crée ma boîte mail www.laposte.net
On Sat, Jan 14, 2012 at 11:47:28PM +0100, syll-dev@laposte.net wrote:
Hello!
I know how to create a font and I could use this to modify/reuse it, but I don't know how to get the font (and its properties) used by a component :( .
Ok, you can query the label for actual font used using the cget function:
(cget label "font")
Hope this helps.
Bye! C.
De : "cage" Objet : Re: [ltk-user] Bold font for label
On Sat, Jan 14, 2012 at 11:47:28PM +0100, syll-dev@laposte.net wrote:
Hello!
I know how to create a font and I could use this to modify/reuse it, but I don't know how to get the font (and its properties) used by a component :( .
Ok, you can query the label for actual font used using the cget function:
(cget label "font")
Hope this helps.
Not really, unfortunately :( . But thank you for your answer :) . And I didn't know cget, which will be usefull.
If I don't specify the font to use for a label, (cget label "font") returns "". If I specify a string as the font to use for a label, (cget label "font") returns this string.
So I can't find the font used for "normal" labels. I would like to say : "the default font with default properties, but weight=bold". I can use :font "Helvetica 10 bold", but not juste :font "bold".
Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ? Je crée ma boîte mail www.laposte.net
On Sun, Jan 15, 2012 at 07:39:53PM +0100, syll-dev@laposte.net wrote:
Hello!
Ok, you can query the label for actual font used using the cget function:
(cget label "font")
Hope this helps.
Not really, unfortunately :( . But thank you for your answer :) . And I didn't know cget, which will be usefull.
If I don't specify the font to use for a label, (cget label "font") returns "". If I specify a string as the font to use for a label, (cget label "font") returns this string.
Well, that appear weird to me! Maybe this is the way Tk works.
So I can't find the font used for "normal" labels. I would like to say : "the default font with default properties, but weight=bold". I can use :font "Helvetica 10 bold", but not juste :font "bold".
Why do not subclass the label widget?
something like:
(defclass my-label (ltk:label) ())
(defmethod initialize-instance :after ((object my-label) &key (font-name "sans") (font-size 10)) (configure object "font" (format nil "~a ~a" font-name font-size)))
This way cget should always return something meaningful. Then you can add method to change only the weigth of the font.
This code is not tested of course, no warranty for any purpouse! :)
Bye! C.
So I can't find the font used for "normal" labels. I would like to say : "the default font with default properties, but weight=bold". I can use :font "Helvetica 10 bold", but not juste :font "bold".
Why do not subclass the label widget?
something like:
(defclass my-label (ltk:label) ())
(defmethod initialize-instance :after ((object my-label) &key (font-name "sans") (font-size 10)) (configure object "font" (format nil "~a ~a" font-name font-size)))
This way cget should always return something meaningful. Then you can add method to change only the weigth of the font.
This code is not tested of course, no warranty for any purpouse! :)
This could help me to have the same font for all labels, but not everywhere in the application because I can't get a "modified default font". But I keep your idea in mind :) .
Thank you for your help.
Syll
Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ? Je crée ma boîte mail www.laposte.net