Bonsoir tout le monde![]()
j'aimerais savoir comment positioner la fenetre principal de mon application au milieu de l'ecran .
j'ai chercher dans la doc mais l'anglais![]()
merci d'avance
a+
Bonsoir tout le monde![]()
j'aimerais savoir comment positioner la fenetre principal de mon application au milieu de l'ecran .
j'ai chercher dans la doc mais l'anglais![]()
merci d'avance
a+
L'anglais est une connaissance indispensable pour tout programmeur, tu aurais donc intérêt à te perfectionner dans cette langue aujourd'hui plus qu'utile... Sinon, voici deux fonctions qui vont t'aider :
Et il faut que tu utilises la fonction geometry() pour placer ta fenêtre ensuite :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 $widget->screenheight Returns a decimal string giving the height of $widget's screen, in pixels. $widget->screenwidth Returns a decimal string giving the width of $widget's screen, in pixels.
Voilà, mais c'était pas trop dur à trouver, fait un effort, pour une fois qu'on a une doc un peu complète...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 $toplevel->geometry(?newGeometry?) If newGeometry is specified, then the geometry of $toplevel is changed and an empty string is returned. Otherwise the current geometry for $toplevel is returned (this is the most recent geometry specified either by manual resizing or in a geometry method). NewGeometry has the form =widthxheight+-x+-y, where any of =, widthxheight, or +-x+-y may be omitted. Width and height are positive integers specifying the desired dimensions of $toplevel. If $toplevel is gridded (see GRIDDED GEOMETRY MANAGEMENT below) then the dimensions are specified in grid units; otherwise they are specified in pixel units. X and y specify the desired location of $toplevel on the screen, in pixels. If x is preceded by +, it specifies the number of pixels between the left edge of the screen and the left edge of $toplevel's border; if preceded by - then x specifies the number of pixels between the right edge of the screen and the right edge of $toplevel's border. If y is preceded by + then it specifies the number of pixels between the top of the screen and the top of $toplevel's border; if y is preceded by - then it specifies the number of pixels between the bottom of $toplevel's border and the bottom of the screen. If newGeometry is specified as an empty string then any existing user-specified geometry for $toplevel is cancelled, and the window will revert to the size requested internally by its widgets.
--
Jedaï
Merci Jedai![]()
Tu a raison j'ai un peut demander trop vite , sa faisaait juste un peut pres 16 heure que j'etait devant mon PC , mais apres avoir demander la question j'ai continuer a chercher et j'ai trouver la reponce (avec geometry ) , mais je me suis dit qu'une autre reponce serait peut etre meilleure .
Sinon j'ai une autre question qui m'a l'air plus compliqué que la premiere :
j'ai fait une application en utilisant TK , puis apres je la 'compile' avec Perl2exe , seulement dans mon application j'affiche une image (jpg) . j'aimerais savoir s'il etait possible d'inclure cette image dans mon exe , pour que je ne soit pas obliger de distribuer l'image a part .
je vous remercie encor une foi , et j'attend (non je cherche) vos reponce pour cette deusieme question.
Etranger
EDIT : c'est bon j'ai trouver![]()
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager