Systeme

Résolu
xilure Messages postés 38 Date d'inscription jeudi 9 février 2006 Statut Membre Dernière intervention 12 juin 2006 - 2 avril 2006 à 16:23
xilure Messages postés 38 Date d'inscription jeudi 9 février 2006 Statut Membre Dernière intervention 12 juin 2006 - 5 avril 2006 à 15:52
comment obtenir l'heure du pc dans un programme

(meme question pour le nom de l'ordinateur, son nom d'utilisateur ...)

et serait il possible de modifier l'heure du pc à partir d'un scripte



j'ai essailler de comprendre les exemples qui sont donné avec des modules (comme pmw) mais y a rien a faire

en gros se que je cherche à faire c'est à modifier certains parametres du pc à partir d'un scripte python



merci d'avance

6 réponses

xeolin Messages postés 336 Date d'inscription samedi 26 novembre 2005 Statut Membre Dernière intervention 8 novembre 2011 2
5 avril 2006 à 13:34
ca ct comment il sort maintenant pourle trouver j'ai utiliser la fonction

help()

de python.

elle fontionne comme ceci:

help('lenomdelabibliothèque')

et aprés elle te sort 10 page sur la fontion. (en anglais)
et ensuite tu utilise le traducteur automatique de Google (pour les monolingues)
3
xeolin Messages postés 336 Date d'inscription samedi 26 novembre 2005 Statut Membre Dernière intervention 8 novembre 2011 2
2 avril 2006 à 17:27
C simple bibliotèque time time.asctime()[10:20]

ex :

from Tkinter import *
from random import randrange
import time
cro=0

class x :
def __init__ (self) :
self._1()
def _1 (self) :
global cro
cro=0
but2.configure(text='non',command=None)
but1.configure(text='oui',command=self._0)
but.configure(text='oui',command=self._2)
but3.configure(text='oui',command=self._3)
self.x=1
def _0 (self) :

but1.configure(text='non',command=None)
but2.configure(text='oui',command=self._1)
but.configure(text='oui',command=self._2)
but3.configure(text='oui',command=self._3)
self.x=0
def _2 (self) :
global cro
cro=0
but.configure(text='non',command=None)
but1.configure(text='oui',command=self._0)
but2.configure(text='oui',command=self._1)
but3.configure(text='oui',command=self._3)
self.x=2
def _3 (self) :
self.x=3
cro=0
but3.configure(text='non',command=None)
but1.configure(text='oui',command=self._0)
but2.configure(text='oui',command=self._1)
but.configure(text='oui',command=self._2)

def print_ (self) :
return self.x



def start ():
global cro
if x_.print_()==1:
fen.title(chr(randrange(255))+chr(randrange(255))+chr(randrange(255))+chr(randrange(255))+chr(randrange(255))+chr(randrange(255))+chr(randrange(255))+chr(randrange(255)))
elif x_.print_()==0:
cros=cro
crom=0
croh=0
croj=0
cro += 0.20
while 1:
if cros >=60:
cros -= 60
crom+=1
else :
break
while 1:
if crom >=60:
crom -= 60
croh+=1
else :
break
while 1:
if croh >=24:
croh -= 24
croj+=1
else :
break
fen.title('%sj%sh%sm%ss'%(croj,croh,crom,cros))
elif x_.print_()==2:
fen.title(time.asctime()[10:20])
elif x_.print_()==3:
fen.title('')
fen.bell()



fen.after(200,start)





fen =Tk()

#################

Label(fen,text='voulez vous demarer la montre ?').grid(row =1,column =1)
Label(fen,text='voulez vous demarer le chrono ?').grid(row =2,column =1)
Label(fen,text='voulez vous metre n\'importe quoi ?').grid(row =3,column =1)
Label(fen,text='voulez vous fair clignoter ?').grid(row =4,column =1)
but=Button(fen,text='oui')
but.grid(row =1,column =2)
but1=Button(fen,text='oui')
but1.grid(row =2,column =2)
but2=Button(fen,text='oui')
but2.grid(row =3,column =2)
but3=Button(fen,text='oui')
but3.grid(row =4,column =2)

x_=x()
start()
##################
fen.mainloop()
0
xilure Messages postés 38 Date d'inscription jeudi 9 février 2006 Statut Membre Dernière intervention 12 juin 2006 2
2 avril 2006 à 17:33
simpa comme scripte mais je ne comprend pas le time time.asctime()[10:20] ???

d'ou il sort ??(et comment l'as tu decouvers ??)

comme sa sa m'evitera de poser trop de question !!!
0
xeolin Messages postés 336 Date d'inscription samedi 26 novembre 2005 Statut Membre Dernière intervention 8 novembre 2011 2
5 avril 2006 à 13:31
time.asctime()

revoit une chaine de caractère par exemple : Wed Apr 05 13:24:50 2006

le premier mot correspond au jour (en toute lettre) le segnd : le moi
La date en chifre (05) l'heur 13:24:50 (ce qui nous interresse et 2006 l'année

je choisi donc de prendre la partie de l'heur donc 13:24:50 et sa localisation est du 10ème au 20ème caractère :si tu veux j'aurai pu écrir :

a=time.asctime()
HEURE=a[10:20]
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
xilure Messages postés 38 Date d'inscription jeudi 9 février 2006 Statut Membre Dernière intervention 12 juin 2006 2
5 avril 2006 à 15:46
d'accord merci beaucoup

dans help('lenomdelabibliothèque')

lenomdelabibliothèque est en anglais ?? (quoique j'essaie tout de suite !!)
0
xilure Messages postés 38 Date d'inscription jeudi 9 février 2006 Statut Membre Dernière intervention 12 juin 2006 2
5 avril 2006 à 15:52
question debile de ma part

merci encore à toi se truc est vraiment pratique domage qu'il ne soit pas plus connu
0
Rejoignez-nous