Pys60 - Tarih/Saat , Resim Konumu ve Tuş Eventleri
by
on 10-02-15 at 06:42 PM (404 Okunma)
Time Modülü ile Zaman Kullanımı
PHP- Kodu:>>> import time
# 1.Örnek
# ---------------------------------------------
>>> t=time.strftime('%A %d %Y',time.localtime())
>>> d=time.strftime('%H:%M:%S',time.gmtime(time.time() - time.timezone))
>>> print str(t)+' - '+str(d)
'Thursday 20 2007 - 11:49:29'
# 2.Örnek
# ---------------------------------------------
>>> a = time.strftime('%X %x')
>>> print a
'17:05:38 11/27/09'
# 3.Örnek
# ---------------------------------------------
>>> b = time.strftime('%A %d %Y %H:%M:%S',time.localtime())
>>> print b
'Friday 27 2009 17:01:52'
Resmi Siteden Bu Modül ile İlgili Açıklamalar ve Bilgiler.Tıkla !
Canvas ile Resmi Belirlenen Pixellere Yerleştirmek
Kod:play_icon = Image.open('e:\\Python\\Xplayer\\play.png') canvas.blit(play_icon,target=(10,68))
Örnek : http://www.python-s60.com/program-is....html#post4648
Tuş Basıldı - Basılıyor ? ...
Yine Örnek : Örnek : http://www.python-s60.com/program-is....html#post4648
Anlamadığın Yer Olursa Çekinme Yaz.
PHP- Kodu:from key_codes import *
def tr(t):return t.decode('utf-8')
execfile('E:\\Python\\Keyboard.class.src')
key=Keyboard()
# key.pressing : Eğer --- Tuşuna Basılıyor ise ...
# key.pressed : Eğer --- Tuşuna Basıldı ise ...
# EKey1,EKey2 ....
while True:
if key.pressing(EKey1):
abc()
if key.pressed(EScancodeLeftArrow):
a = 12
if key.pressed(EScancodeRightArrow):
a = 12
if key.pressed(EScancodeDownArrow):
abc()
if key.pressed(EScancodeUpArrow):
a = 12
Ekteki Dosya Son Verdiğimin Script Halidir...PHP- Kodu:# Api
#
# path = 'E:\\Python\\Keyboard.class.src'
# execfile((path))
# key = Keyboard()
#
# Api
class Keyboard(object):
__module__ = __name__
def __init__(self):
self.state = {}
self.buffer = {}
def handle_event(self, event):
code = event['scancode']
if (event['type'] == EEventKeyDown):
self.buffer[code] = 1
self.state[code] = 1
elif (event['type'] == EEventKeyUp):
self.state[code] = 0
def pressing(self, code):
return self.state.get(code, 0)
def pressed(self, code):
if self.buffer.get(code, 0):
self.buffer[code] = 0
return 1
return 0











EMail ile Gönder
