* tk scale
@ 1999-02-02 18:51 Pascal Rigaux
1999-02-03 16:07 ` Francois Pessaux
1999-02-07 2:47 ` Francois Rouaix
0 siblings, 2 replies; 4+ messages in thread
From: Pascal Rigaux @ 1999-02-02 18:51 UTC (permalink / raw)
To: caml-list
I'm looking for something to convert the Pixels units to Millimeters in a canvas.
Seems like the tk function is "tk scale", but i can't find it in ocamltk41 :(
I could do without it (seems like by default there is 3.66 factor between the
2), but i wonder if it could be done another way...
Precision: i can't use Pixels by default 'cuz it's int and not float and so
isn't precise enough... That's why i use Millimeters. But when i ask something
to tk, it answers in Pixels (eg: winfo reqwidth, ev_MouseX, winfo width)
PS: the prog i'm writing is a function plotting tool (a la gnuplot), math
oriented. The code is on ftp://dre2.polytechnique.fr/pub/graph-plotting.tgz
cu Pixel.
--------------------------------------------------------------------------------
En francais (dingue ce que je suis courageux :)
Donc :
Je cherche a convertir des Pixels en Millimeters (type units) dans un canvas.
La fonction qui semble faire ca en tk, c'est "tk scale" mais je l'a trouve pas
des ocamltk41 :(
Je pourrais faire sans (un bete facteur 3.66, par defaut), mais je me demande si
il y aurait pas mieux et plus propre...
Precision: je peux pas utiliser les Pixels parce que c'est des int et c'est pas
assez precis... Conclusion j'utilise des Millimeters. Mais quand je pose des
questions a tk, il repond en int alias Pixels (ex: winfo reqwidth, ev_MouseX,
winfo width)
PS: le prog que j'ecris sert a tracer des courbes (a la gnuplot), mais oriente
math. Par exemple il gere x=2, les inequations (hachures) et les tangentes. Le
code se trouve sur ftp://dre2.polytechnique.fr/pub/graph-plotting.tgz
a+ Pixel.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tk scale
1999-02-02 18:51 tk scale Pascal Rigaux
@ 1999-02-03 16:07 ` Francois Pessaux
1999-02-07 2:47 ` Francois Rouaix
1 sibling, 0 replies; 4+ messages in thread
From: Francois Pessaux @ 1999-02-03 16:07 UTC (permalink / raw)
To: caml-list
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 941 bytes --]
Bonjour,
> Je cherche a convertir des Pixels en Millimeters (type units) dans un canvas.
> La fonction qui semble faire ca en tk, c'est "tk scale" mais je l'a trouve
> pas des ocamltk41 :(
Il existe une fonction:
val scale : widget -> tagOrId -> units -> units -> float -> float -> unit
(* tk invocation: <widget> scale <tagOrId> <units> <units> <float> <float> *)
Je ne sais pas si elle fait ce que vous voulez, mais au moins, ça correspond
à l'invocation Tk que vous mentionnez. Elle se trouve dans le module Tk
(voir l'interface: /usr/local/lib/ocaml/camltk41/safetk.mli)
^^^^^^^^^^^^^^^^^^^^
Chemin où vous avez installé la lib standard d'Ocaml
J'espère que ça aide...
(* Francois PESSAUX (Francois.Pessaux@inria.fr) *)
(* INRIA Rocquencourt - Projet CRISTAL *)
(* (http://pauillac.inria.fr/~pessaux) *)
;;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tk scale
1999-02-02 18:51 tk scale Pascal Rigaux
1999-02-03 16:07 ` Francois Pessaux
@ 1999-02-07 2:47 ` Francois Rouaix
1 sibling, 0 replies; 4+ messages in thread
From: Francois Rouaix @ 1999-02-07 2:47 UTC (permalink / raw)
To: Pascal Rigaux; +Cc: caml-list
> I'm looking for something to convert the Pixels units to Millimeters in a canvas.
> Seems like the tk function is "tk scale", but i can't find it in ocamltk41 :(
>
> I could do without it (seems like by default there is 3.66 factor between the
> 2), but i wonder if it could be done another way...
Yes, unfortunately, we may have missed some functions in ocamltk41, and
probably
miss most of the functions added in Tcl/Tk 8.0.
There is always the solution of adding entries in the Widgets.src file of
the ocamltk distribution, or simply create new .src files and apply the
"tkcompiler" to generate the stubs.
In this case, I would expect that something like
module tkscale {
function (float) get ["tk"; "scale"]
function () set ["tk"; "scale"; float]
}
would be enough to lift the "tk scale" command. However, a brief look
at Welch's book does not confirm that this command can be used to do
what you describe (eg converting from Pixels to Millimeters).
--f
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tk scale
[not found] <199902031605.RAA05257@mouton.inria.fr>
@ 1999-02-03 16:14 ` Pascal Rigaux
0 siblings, 0 replies; 4+ messages in thread
From: Pascal Rigaux @ 1999-02-03 16:14 UTC (permalink / raw)
To: Francois Pessaux
>
> Il existe une fonction:
>
> val scale : widget -> tagOrId -> units -> units -> float -> float -> unit
> (* tk invocation: <widget> scale <tagOrId> <units> <units> <float> <float> *)
>
C'est triste mais, ce n'est pas celle la :(
En fait il y a le widget scale, la fonction scale sur les objets d'un canvas,
et la fonction "tk scale" qui prend un argument optionnel...
Ca, c'est ce que dit la doc tk.
Merci quand meme, Pixel.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-02-08 8:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-02 18:51 tk scale Pascal Rigaux
1999-02-03 16:07 ` Francois Pessaux
1999-02-07 2:47 ` Francois Rouaix
[not found] <199902031605.RAA05257@mouton.inria.fr>
1999-02-03 16:14 ` Pascal Rigaux
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox