![]() |
| |||||||
Python S60 içinde Python Modül Kullanımları ve Açıklamaları ! [bakidilek & pys60] konusu , panel yapımı biraz karmaşık gelebilir ama aslında bi kez yapınca kolay olduğunu göreceksiniz. panel yapmak yazacağınız uygulamalarda basit ayarlar kısmı oluş...
![]() |
| | LinkBack | Seçenekler | Stil |
| | #1 |
| Python & C++ Wizard ![]() | panel yapımı biraz karmaşık gelebilir ama aslında bi kez yapınca kolay olduğunu göreceksiniz. panel yapmak yazacağınız uygulamalarda basit ayarlar kısmı oluşturmaya, yada yazdığınız programdaki şeçenekleri direk ekrana eklemenizi sağlar. ########örnek1########## Kod:
# Copyright (c) 2006 Jurgen Scheible
# This script creates tabs that let you switch between different applications
import appuifw
import e32
from graphics import *
# define application 1: text app
app1 = appuifw.Text(u'Appliation o-n-e is on')
# define application 2: text app
app2 = appuifw.Text(u'Appliation t-w-o is on')
# define application 3: text app
app3 = appuifw.Text(u'Appliation t-h-r-e-e is on')
def exit_key_handler():
app_lock.signal()
# create a tab handler that switches the application based on what tab is selected
def handle_tab(index):
global lb
if index == 0:
appuifw.app.body = app1 # switch to application 1
if index == 1:
appuifw.app.body = app2 # switch to application 2
if index == 2:
appuifw.app.body = app3 # switch to application 3
# create an Active Object
app_lock = e32.Ao_lock()
# create the tabs with its names in unicode as a list, include the tab handler
appuifw.app.set_tabs([u"One", u"Two", u"Three"],handle_tab)
# set the title of the script
appuifw.app.title = u'Tabs'
# set app.body to app1 (for start of script)
appuifw.app.body = app1
appuifw.app.exit_key_handler = exit_key_handler
app_lock.wait() şimdi ikinci ve daha güzel olan paneli oluşturalım. ########örnek2########## Kod:
# Copyright (c) 2006 Jurgen
# This script creates tabs that let you switch between different applications
# listbox app, listbox app and canvas app
# bakidilek tarafından düzenlenmiş halidir.
import appuifw
import e32
from graphics import *
# define application 1: listobx app
# create your icons for the listbox content
icon1 = appuifw.Icon(u"z:\\system\\data\\avkon.mbm", 28, 29)
icon2 = appuifw.Icon(u"z:\\system\\data\\avkon.mbm", 40, 41)
icon3 = appuifw.Icon(u"z:\\system\\data\\avkon.mbm", 30, 31)
icon4 = appuifw.Icon(u"z:\\system\\data\\avkon.mbm", 32, 33)
icon5 = appuifw.Icon(u"z:\\system\\data\\avkon.mbm", 34, 35)
icon6 = appuifw.Icon(u"z:\\system\\data\\avkon.mbm", 36, 37)
icon7 = appuifw.Icon(u"z:\\system\\data\\avkon.mbm", 38, 39)
# create your content list of your listbox including the icons to be used for each entry
entries = [(u"Signal", icon1),
(u"Battery", icon2),
(u"Sirene", icon3),
(u"Waste", icon4),
(u"Helicopter", icon5),
(u"Train", icon6),
(u"Auto", icon7)]
# create the listbox callback handler
def handler():
print "done"
# create an instance of appuifw.Listbox(), include the content list "entries" and the callback function "handler"
app1 = appuifw.Listbox(entries,handler)
# define application 2: listbox app
# define the list of items as pop-up menu content
L2 = [u"ali", u"mustafa", u"abuzittin", u"banu alkan"]
# create the listbox callback handler
##### ufak bi degisiklik yapıyoruz##########
def hit85():
appuifw.note(u"bu da fonksiyon")
def handler_L2():
secim = appuifw.app.body.current()
if secim == 0:
appuifw.note(u"umarım istedigin budur")
if secim == 1:
appuifw.note(u"deneme")
if secim == 2:
hit85()
if secim == 3:
print "\n : )"
##############################################
# create the pop-up menu
app2 = appuifw.Listbox(L2, handler_L2)
# define application 3: canvas application
def app_3():
global canvas
img=Image.new((176,208))
img.line((20,20,20,120),0xff00ee)
img.rectangle((40,60,50,80),0xff0000)
img.point((50.,150.),0xff0000,width=40)
img.ellipse((100,150,150,180),0x0000ff)
img.text((100,80), u'hello')
# define your redraw function (still belonging to app 3)
def handle_redraw(rect):
#global canvas
canvas.blit(img)
# define the canvas, include the redraw callback function
canvas =appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw)
appuifw.app.body = canvas
def exit_key_handler():
app_lock.signal()
# create a tab handler that switches the application based on what tab is selected
def handle_tab(index):
global lb
if index == 0:
appuifw.app.body = app1 # switch to application 1
if index == 1:
appuifw.app.body = app2 # switch to application 2
if index == 2:
app_3() # switch to application 3
# create an Active Object
app_lock = e32.Ao_lock()
# create the tabs with its names in unicode as a list, include the tab handler
appuifw.app.set_tabs([u"One", u"Two", u"Three"],handle_tab)
# set the title of the script
appuifw.app.title = u'Tabs advanced'
# set app.body to app1 (for start of script)
appuifw.app.body = app1
appuifw.app.exit_key_handler = exit_key_handler
app_lock.wait() ![]() ![]() ![]() 2. örneği sizin için biraz geliştirdim umarım beğenirsiniz. NOT: kodları kopyala yapıştır yapmayın eklentideki örnekleri bilgisayarınıza indirin. konuyu birleştirdim ve bende biraz eklenti yapacam kusura bakma böyle olması formun düzenli olması açısından önemli Konu pys60 tarafından (06-02-08 Saat 15:18 ) değiştirilmiştir.. |
| | |
| | #2 |
| Python & C++ Wizard ![]() | form da aynı panel gibi gibidir.ama farklı yönleri de vardır resimlerde farklı olduğu taraflar görünmekte. ##############ornek################ Kod:
# Copyright (c) 2006 Jurgen Scheible
# This script creates a form
import appuifw
import e32
# create an Active Object
app_lock = e32.Ao_lock()
def forming():
# create a list to be used in 'combo' selection mode
model = [u'6600', u'6630', u'7610', u'N90', u'N70']
# define the field list (consists of tuples: (label, type ,value)); label is a unicode string
# type is one of the following strings: 'text', 'number', 'date', 'time',or 'combo'
data = [(u'Mobile','text', u'Nokia'),(u'Model','combo', (model,0)),(u'Amount','number', 5),(u'Date','date'),(u'Time','time')]
# set the view/edit mode of the form
flags = appuifw.FFormEditModeOnly
# creates the form
f = appuifw.Form(data, flags)
# make the form visible on the UI
f.execute()
def exit_key_handler():
app_lock.signal()
# set the title of the script
appuifw.app.title = u'Form'
# call the function that creates the form
forming()
appuifw.app.exit_key_handler = exit_key_handler
app_lock.wait() orneğe ait resimler: ![]() gördüğünüz gibi panelden biraz farklı. NOT: kopyala yapıştır yapmayın eklentiden bu örneği indirebilirsiniz. Konu bakidilek tarafından (05-02-08 Saat 20:57 ) değiştirilmiştir.. |
| | |
| | #3 |
| Python & C++ Wizard ![]() | bu örnek daha çok yeni ve ilk kez bi türk sitesinde yayınlanıyor.umarım beğenirsiniz.uyuglamanın nasıl yapıldığını aşağıda anlattım. ############ornek############# Kod: # Copyright (c) 2008 Jurgen Scheible Pocket PC, Symbian OS, Palm OS, Smartphone, Nokia, SonyEricsson, Java Forum - vBulletin import e32, camera, appuifw, key_codes, graphics im_1 =graphics.Image.open('e:\\python\\resources\\ui\\img_1.jpg') im_2 =graphics.Image.open('e:\\python\\resources\\ui\\img_2.jpg') im_3 =graphics.Image.open('e:\\python\\resources\\ui\\img_3.jpg') im_4 =graphics.Image.open('e:\\python\\resources\\ui\\img_4.jpg') photo = im_1 def press_down(): global photo if photo == im_1: photo = im_3 elif photo == im_2: photo = im_4 canvas.blit(photo) def press_up(): global photo if photo == im_3: photo = im_1 elif photo == im_4: photo = im_2 canvas.blit(photo) def press_right(): global photo if photo == im_1: photo = im_2 elif photo == im_3: photo = im_4 canvas.blit(photo) def press_left(): global photo if photo == im_2: photo = im_1 elif photo == im_4: photo = im_3 canvas.blit(photo) def press_select(): global photo if photo == im_1: appuifw.note(u"Action 1 ", "info") elif photo == im_2: appuifw.note(u"Action 2 ", "info") elif photo == im_3: appuifw.note(u"Action 3 ", "info") elif photo == im_4: appuifw.note(u"Action 4 ", "info") canvas.blit(photo) def item1(): appuifw.note(u"Action 5 ", "info") def item2(): appuifw.note(u"Action 6 ", "info") def handle_redraw(rect): global photo canvas.blit(photo) def quit(): app_lock.signal() canvas=appuifw.Canvas(redraw_callback=handle_redraw) appuifw.app.body=canvas canvas.bind(key_codes.EKeySelect, press_select) canvas.bind(key_codes.EKeyDownArrow, press_down) canvas.bind(key_codes.EKeyUpArrow, press_up) canvas.bind(key_codes.EKeyRightArrow, press_right) canvas.bind(key_codes.EKeyLeftArrow, press_left) canvas.blit(photo) appuifw.app.menu = [(u"Action 5", item1), (u"Action 6", item2)] appuifw.app.exit_key_handler=quit appuifw.app.screen='full' appuifw.app.title = u"My UI" appuifw.app.exit_key_handler = quit app_lock = e32.Ao_lock() app_lock.wait() ornek resimler: ![]() ![]() NOT: kodu kopyala yapışıtr yapmayın eklentiden örneği indirebilirsiniz. |
| | |
| | #4 |
| Python & C++ Wizard ![]() | evet basma efektli buton yapalım beraber.bu uygulamada da eklentide verilen resimleri direk e'ye atıyoruz ki program çalışsın. ###########ornek########## [code] # Copyright (c) 2005 Jurgen Scheible # use keyboard key Select to press the graphical button import appuifw import e32 from key_codes import * from graphics import * class Keyboard(object): def __init__(self,onevent=lambda:None): self._keyboard_state={} self._downs={} self._onevent=onevent def handle_event(self,event): if event['type'] == appuifw.EEventKeyDown: code=event['scancode'] if not self.is_down(code): self._downs[code]=self._downs.get(code,0)+1 self._keyboard_state Kod: =1
elif event['type'] == appuifw.EEventKeyUp:
self._keyboard_state[event['scancode']]=0
self._onevent()
def is_down(self,scancode):
return self._keyboard_state.get(scancode,0)
def pressed(self,scancode):
if self._downs.get(scancode,0):
self._downs[scancode]-=1
return True
return False
keyboard=Keyboard()
def quit():
global running
running=0
appuifw.app.set_exit()
im_back =Image.open('e:\\gui_background.jpg')
im_front =Image.open('e:\\gui_foreground.jpg')
running=1
appuifw.app.screen='full'
canvas=appuifw.Canvas(event_callback=keyboard.handle_event, redraw_callback=None)
appuifw.app.body=canvas
appuifw.app.exit_key_handler=quit
while running:
if keyboard.is_down(EScancodeSelect):
photo = im_front
else:
photo = im_back
canvas.blit(photo)
# Wait for something to happen
e32.ao_yield() örneğe ait resim: ![]() Not: bu kodu kopyala yapıştır yapmayın aşağıdan örneği ve çalıştırmak için gerekli olan resimleri indirebilirsiniz.aksi taktirde çalışmaz Konu bakidilek tarafından (05-02-08 Saat 23:54 ) değiştirilmiştir.. |
| | |
| | #5 |
| Administrator ![]() Üyelik tarihi: Jan 2007 Nerden: ♥Heryer Bizim♥
Mesajlar: 7.947
Telefonum: _-_
Reputation : ![]() (58) | Eline sağlık, coştun bugün ![]()
__________________ Özel Mesajlara cevap vermiyorum, sorununuz varsa forumu kullanın lütfen. Best World Online NEDEN BURADAYIZ ? Yeni dönem ile yeniden merhaba ! Kalıpları kopyalayalamaktan, kişisel ve ekip çıkarlarından, "al-kur-kullan" mantığından uzak iki ortam bir araya geldi. Bugünden itibaren yeni dönem faaliyetlerine başlayarak, aynı samimiyet, aynı amaç ve bütünleştirici yapısıyla yoluna devam edecek olan Türkiye'nin Açık Kaynağı MOBIL-FORUM, yeni birlikteliklere de her zaman açık olacaktır. .
İlk hedefimiz gerçek anlamda bütünleştirici olmak. Konularımızda faaliyet gösteren tüm guruplara eşit seviyede olacak, düşmanlık barındırmayacak, varlık sebebimiz olan "paylaşım"a hizmet edebilmek için ortak projeler geliştirmeye hazır olacağız. Forum içi doğru eğitim adımları ile kullanıcılarımızın sadece bir içerik yönetim sistemini kurabilen değil, ona yeni bir yüz, yeni bir kimlik kazandırabilen ve doğru yönetebilen olmalarını sağlayacağız. Üretime önem vereceğiz. Üretmek için bağımsız ya da ortak çalışmalarda bulunurken, tamamen dış kaynaklı olan üretimlerden de kimseyi mahrum bırakmayacağız. Çalışma teknik ve planlarımız ile dâima randımanlı çalışabilen sabit kadromuzu oluşturarak kalıcı bir yararlılık sağlayacağız. |
| | |
| | #6 |
| Python & C++ Wizard ![]() | arkadaşlar bunlar diyalog deyimleri olarak adlandırılır. ###########örnek############# Kod:
örneğe dair resimler: ![]() ![]() NOT:kodları kopyala yapıştır yapmayın hata alırsınız eklentide örnek mevcut ordan indirin. |
| | |
| | #7 |
| Mobil TeaM ![]() | import appswitch ----------------------------------------- appswitch.kill_app(u'Phone') <=>programı sonlandırır ----------------------------------------- appswitch.end_app(u'Phone') <=>uygulamayı kapatır ----------------------------------------- appswitch.switch_to_fg(u'Phone') <=>uygulamayı ön plana getirir ----------------------------------------- appswitch.switch_to_bg(u'Phone') <=>uygulamayı arka plana atar ----------------------------------------- appswitch.application_list() <=>uygulamaları listeler ----------------------------------------- appswitch.process_list() <=>işlemleri listeler ----------------------------------------- appswitch.kill_process() <=>işlemleri sonlandırır ----------------------------------------- bir örnek ----------------------------------------- import appswitch def uygulamaismi_fg(): return appswitch.application_list(1)[0] def is_uygulamaismi_fg(appname): return uygulamaismi_fg()==uygulamaismi |
| | |
| | #8 |
| Mobil TeaM ![]() | import appuifw appuifw.note(u"Hello World!") çıktısı Hello World! ----------------------------------------- bunu appuifw.note(u"Hello World!","note") normal pop ekranı appuifw.note(u"Hello World!","conf") ayar pop ekranı appuifw.note(u"Hello World!","error") hata pop ekranı ----------------------------------------- appuifw.query(u"UID gir", "text", u"0xXXXXXXXX") diğer soru çeşitleri 1) "code" kod girişleri için 2) "number" numara girmek için 3) "date" tarih girişi 4) "time" saat girişi 5) "float" hata girişli 6) "query"sorulu en çok çıkışlarda kullanılır isterseniz konsolda bakalım appuifw.query(u"You want exit?", "query") ¤¤¤¤> def exit(): if appuifw.query(u"emin misiniz?", "query")==1: appuifw.note(u"evet") else: appuifw.note(u "hayır") ¤¤¤¤> ----------------------------------------- uygulamaya çıkış kodu appuifw.app.set_exit() veya os.abort() olabilir ¤¤¤¤> def exit(): if appuifw.query(u"emin misiniz?", "query")==1: appuifw.app.set_exit() ¤¤¤¤> appuifw.app.menu([(u"cik",exit)]) ¤¤¤¤> ilk önce kodek içine menü ismi virgül fonksiyon ismi yada appuifw.app.menu=[(u'a',((u'a',a),(u'a',a)))] şeklinde menü içine menü eklenir böylece basit bir menü gördük ----------------------------------------- -----------------------------------------ekran boyutu için appuifw.app.screen='full' 'full'-tam ekran 'large'-büyük 'normal'-bildiğimiz ----------------------------------------- ¤¤¤¤> appuifw.app.full_name() u"c:\\system\\apps\\Python\\Python.app" tam isim için ----------------------------------------- exit_key_handler() çıkış tuşuna fonksiyon atamak için ¤¤¤¤> def exit(): ... if appuifw.query(u"You want exit?", "query")==1: ... appuifw.app.set_exit() ¤¤¤¤> appuifw.app.exit_key_handler = exit ----------------------------------------- popup_menu(liste[, label]) ¤¤¤¤> liste = [ u"Open", u"Delete", u"Save", u"Load"] ¤¤¤¤> index = appuifw.popup_menu(liste, u"menu:") ¤¤¤¤> index 0 ¤¤¤¤> liste[index] u"Open" ¤¤¤¤> |
| | |
| | #9 |
| Mobil TeaM ![]() | import audio x=audio.Sound.open(u'ses dosyasının yeri') e:\sound.mp3 x.play() sesi çalar ----------------------------------------- file managerden seçip oynatmak için import audio,lite_fm x=lite_fm.manager() x.play(0) 0 yalnız 1 defa çalar ----------------------------------------- import audio,lite_fm x=lite_fm.manager() x=audio.Sound.open(x) ----------------------------------------- x.play() oynatmak için ----------------------------------------- x.record() ses kaydı için x.stop() durdurmak için x.close() kaydınızı depolar x.set_volume() sesi ayarlar |
| | |
| | #10 |
| Mobil TeaM ![]() | Kod: ¤¤¤¤> import appuifw ¤¤¤¤> dir(appuifw) [‘Canvas’, ‘Form’, ‘Listbox’, ‘Text’, ‘Icon’, ‘Content_handler’, ‘app’, ‘multi_query’, ‘note, ‘popup_menu’, ‘query’, ‘selection_list’, ‘multi_selection_list’, ‘available_fonts’, ‘EEventKeyUp, ‘EEventKeyDown’, ‘EEventKey’, ‘FFormAutoFormEdit’, ‘FFormAutoLabelEdit’, ‘FFormDoubleSpaced’, ‘FFormEditModeOnly’, ‘FFormViewModeOnly’, ‘STYLE_BOLD’, ‘STYLE_ITALIC’, ‘STYLE_STRIKETHROUGH’, ‘STYLE_UNDERLINE’, ‘HIGHLIGHT_STANDARD’, ‘HIGHLIGHT_ROUNDED’, ‘HIGHLIGHT_SHADOW’, ‘EScreen’, ‘EApplicationWindow’, ‘EStatusPane’, ‘EMainPane’, ‘EControlPane’, ‘ESignalPane’, ‘EContextPane’, ‘ETitlePane’, ‘EBatteryPane’, ‘EUniversalIndicatorPane’, ‘ENaviPane’, ‘EFindPane’, ‘EWallpaperPane’, ‘EIndicatorPane’, ‘EAColumn’, ‘EBColumn’, ‘ECColumn’, ‘EDColumn’, ‘EStaconTop’, ‘EStaconBottom’, ‘EStatusPaneBottom’, ‘EControlPaneBottom’, ‘EControlPaneTop’, ‘EStatusPaneTop’] ¤¤¤¤>birde os modulünü deneyin |
| | |
| | #11 |
| Mobil TeaM ![]() | ao_callgate(wrapped_callable) ----------------------------------------- drive_list() diskleri listeler ----------------------------------------- file_copy(kaynak dosya, kopyalanacağı yer) dosya kopyalamak için ----------------------------------------- in_emulator() emulator başlatılır ----------------------------------------- pys60_version_info python versiyonunu gösterir ----------------------------------------- s60_version_info symbian versiyonu için ----------------------------------------- bool is_ui_thread() ----------------------------------------- start_exe(exe yolu) exe çaliştırır ----------------------------------------- start_server(filename) server çalıstırır serverler için system explore veya unreal devmana bakın ----------------------------------------- .wait() bekletir ----------------------------------------- .signal() kullanıcıyın aktif olduğunu gösterir(inactivity için) |
| | |
| | #12 |
| Mobil TeaM ![]() | ---------------------------------------- ¤¤¤¤> e32.ao_sleep(5) beş saniye bekletir ----------------------------------------- beş saniye sonra program çalıştırır ¤¤¤¤> def callback(): print "Hello!" ¤¤¤¤> e32.ao_sleep(5, callback) Hello! ¤¤¤¤> ----------------------------------------- |
| | |
| | #13 |
| Mobil TeaM ![]() | inactivity() ¤¤¤¤> for index in xrange(10): … print e32.inactivity() … e32.ao_sleep(1) … ¤¤¤¤> inactivite() reset_inactivity() ¤¤¤¤> for index in range(20): … print e32.inactivity() … if e32.inactivity() > 5: … e32.reset_inactivity() … e32.ao_sleep(1) … ¤¤¤¤> |
| | |
| | #14 |
| Mobil TeaM ![]() | focus() 0 yanlış 0 dısındakiler doğrudur 1 gibi ¤¤¤¤> def call(focus): ... if focus == 1: ... print ‘foreground’ ... else: ... print ‘background’ ... ¤¤¤¤> appuifw.app.focus = call ¤¤¤¤> background ¤¤¤¤> foreground ¤¤¤¤> |
| | |
| | #15 |
| Mobil TeaM ![]() | ImportError ¤¤¤¤> import appuifwww Traceback (most recent call last): File "<console>", line 1, in ? ImportError: No module named appuifwww ----------------------------------------- modülü bulamadı libs klasörüne bakın varsa chmod una bakın ----------------------------------------- IndexError ¤¤¤¤> list = [1, 2, 3] ¤¤¤¤> list [9] Traceback (most recent call last): File "<console>", line 1, in ? IndexError: list index out of range ----------------------------------------- index içinde olmayan sayı ya indexi yükseltin ya da sayıyı index içinden şeçin ----------------------------------------- MemoryError ¤¤¤¤> range (10000000) Traceback (most recent call last): File "<console>", line 1, in ? MemoryError ----------------------------------------- RAM Yetersiz yapacak tek şey sayıyı küçültmek ----------------------------------------- NameError ¤¤¤¤> 1 + a Traceback (most recent call last): File "<console>", line 1, in ? NameError: name 'a' is not defined ----------------------------------------- a'yı bulamadı a=bir integer demelisiniz ----------------------------------------- SyntaxError ¤¤¤¤> 1 + 0 + File "<console>", line 1 1+0+ ^ SyntaxError: invalid syntax ----------------------------------------- söz diziminde hatanız var satırı kontrol edin burda fazladan + var ----------------------------------------- TypeError ¤¤¤¤> 1 + ‘2’ Traceback (most recent call last): File "<console>", line 1, in ? TypeError: unsupported operand types for +: 'int' and 'str' ----------------------------------------- tip hatası int veya str içinde olmalı ----------------------------------------- ZeroDivisionError ¤¤¤¤> 1 / 0 Traceback (most recent call last): File "<console>", line 1, in ? ZeroDivisionError: integer division or modulo by zero ----------------------------------------- 0 hatası 0 ile ilgili bir sorun var burda sonuç tanımsız birde PyS60 Tutorial Menu buradaki altta hataların ayıklanması var orayada bakın Konu pys60 tarafından (06-02-08 Saat 16:44 ) değiştirilmiştir.. |
| | |
![]() |
| Bookmarks |
| Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir) | |
| Seçenekler | |
| Stil | |
| |