memo demo
https://www.youtube.com/watch?v=-rkRcqboaIE&feature=youtu.be
memo full
https://www.youtube.com/watch?v=mYaS5QEkIwU&feature=youtu.be
วันพฤหัสบดีที่ 24 พฤศจิกายน พ.ศ. 2559
วันอังคารที่ 15 พฤศจิกายน พ.ศ. 2559
Memo : เพิ่มปุ่ม Setting
เพิ่มใน memo.kv
+ ToolButton:
+ text: 'Setting'
+ background_color: .2,1,1,1
+ on_release: root.show_setting(*args)
เพิ่มใน memo.py
+ def show_setting(self,instance):
+ print("Setting PAGE")
+ ToolButton:
+ text: 'Setting'
+ background_color: .2,1,1,1
+ on_release: root.show_setting(*args)
เพิ่มใน memo.py
+ def show_setting(self,instance):
+ print("Setting PAGE")
Memo : แก้ไข favourite ให้ทำงานถูกต้อง
แก้ไขตอน save favourite
เป็น
fav_txt.write(path_leaf(self.all_file.files[self.index])+",")
จากเดิม
fav_txt.write(","+path_leaf(self.all_file.files[self.index]))
เป็น
fav_txt.write(path_leaf(self.all_file.files[self.index])+",")
จากเดิม
fav_txt.write(","+path_leaf(self.all_file.files[self.index]))
วันอาทิตย์ที่ 13 พฤศจิกายน พ.ศ. 2559
Memo : ใช้งาน favourite ได้แล้ว
เพิ่มฟังก์ชั่น save_favourite เรียกใช้ตอนกดปุ่ม Add to favourite (ในหน้า View)
โดยจะเซฟลงไฟล์ favourite หากไม่ซ้ำกับชื่อไฟล์ใน favourite (มีอยู่ก่อนแล้ว)
โดยจะเซฟลงไฟล์ favourite หากไม่ซ้ำกับชื่อไฟล์ใน favourite (มีอยู่ก่อนแล้ว)
Memo : เพิ่มปุ่ม favourtie
ToolButton:
text: 'Favourite'
background_color: 1,1,.5,1
on_release: root.favourite()
เพิ่มปุ่มใน memo.kv
-------------------------------------------------------
btn_add_fav = Button(text="Add to favourite", size_hint=(1,.1), background_color=(1,1,.5,1))
เพิ่มปุ่มใน memo.py
text: 'Favourite'
background_color: 1,1,.5,1
on_release: root.favourite()
เพิ่มปุ่มใน memo.kv
-------------------------------------------------------
btn_add_fav = Button(text="Add to favourite", size_hint=(1,.1), background_color=(1,1,.5,1))
เพิ่มปุ่มใน memo.py
วันศุกร์ที่ 4 พฤศจิกายน พ.ศ. 2559
Memo: เปลี่ยนฟอนต์ของ popup ให้เป็น THSarabun
เข้าไปแก้ไข ส่วนของ create_popup ใน
memo.py
editor.py
delete.py
ด้วยการเพิ่มคำสั่ง title_font='./font/THSarabunNew',
title_size=20,
memo.py
editor.py
delete.py
ด้วยการเพิ่มคำสั่ง title_font='./font/THSarabunNew',
title_size=20,
วันอังคารที่ 1 พฤศจิกายน พ.ศ. 2559
Memo : Edit
สร้างไฟล์ Edtior.kv โดยใช้เป็น AnchorLayout
![]() |
| method สร้าง popup โดย ปุ่ม save จะ bind กับ method self.save ( เมื่อกดปุ่ม save จะเรียกใช้ method self.save) |
| method เมื่อกดปุ่ม edit ใน Editor.py (เช็คว่ามีการเลือกไหม) |
![]() |
| ถูกเรียกจาก method show_edit (รูปบน) ใน Editor.py |
เมื่อเลือกไฟล์แล้วกด Edit
จะขึ้น Popup โดยใน popup มี textbox ที่มีเนื้อหาในไฟล์ที่เลือกอยู่แล้ว พอแก้ไขเสร็จให้กด Save จะเรียกใช้ method self.save
reference
การทำ path ให้เหลือชื่อไฟล์อย่างเดียว
วันศุกร์ที่ 21 ตุลาคม พ.ศ. 2559
OX : Save and Load
![]() |
| Option อยู่ใน GameOX |
![]() |
| Option ในไฟล์ kivy |
![]() |
| class ButtonOX แยกคำสั่งพวกตั้งรูปภาพไปอยู่ใน method set_picture |
แยกปุ่ม Restart ไปอยู่ในคลาสใหม่ที่ชื่อ Option
และเพิ่มปุ่ม Save , Load
การโหลดไฟล์
http://stackoverflow.com/questions/25924720/filenotfounderror-errno-2
| class Option method restart แยกจาก StatusBar มาอยู่ใน Option เพิ่ม method save_game , load_save
update 22/10/16
ในmethod save ให้ save ผู้เล่น ด้วย
method load ให้นำเข้าผู้เล่นด้วย
|
การโหลดไฟล์
http://stackoverflow.com/questions/25924720/filenotfounderror-errno-2
วันพฤหัสบดีที่ 20 ตุลาคม พ.ศ. 2559
OX : Show Winner และ ปุ่ม playagain ตอนจบเกม
วันพุธที่ 19 ตุลาคม พ.ศ. 2559
วันพฤหัสบดีที่ 13 ตุลาคม พ.ศ. 2559
Quiz2 description
Quiz2
ข้อที่ 1 change on_children to on_30september
| drawingspace.py |
เพิ่มให้เรียกใช้ on_30september เพื่อนับจำนวน children ใน toolbox.py หลัง add_widget
| toolbox.py |
| toolbox.py |
| generaloption.py |
ข้อที่ 2 เมื่อ group แล้ว พอกด remove ให้ remove ที่เลือกทั้งหมด
| generaloption.py |
ไปแก้ไขในไฟล์ generaloption.py โดยการเพิ่มเงื่อนไข
if self.group_mode == True ให้ remove แบบ group นอกนั้นให้ remove แบบเดิม
โดยการ remove จะเช็คว่าโดนเลือกอยู่หรือไม่
ถ้าใช่ก็จะ remove
ที่วนเป็นแบบ reversed เพราะว่าหากวนแบบไปข้างหน้าเมื่อทำการ remove ไป 1 ตัว
[1,2,3,4] //remove
| < ตัวชี้
[2,3,4, ] // ตัวชี้จะชี้เลข 3 ซึ่งข้ามเลข 2 ไป เพราะว่า ตัวที่ 2,3,4 จะเลื่อนมาตำแหน่งตัว 1 ที่ถูก remove
|
หากเป็นแบบ reversed จะไม่ข้าม
ข้อที่ 3 นับ Stickman และไปแสดงใน statusbar
เมื่อใช้คำสั่งprint(str(type(child))) ดู พบว่า
![]() |
| ลอง print(str(type(child))) |
จึงนำมาใช้เช็คเงื่อนไขเพื่อนับ stickman ได้
![]() |
| drawingspace.py |
![]() |
| statusbar.kv |
![]() |
| statusbar.py |
Quiz2 description
Quiz2
ข้อที่ 1 change on_children to on_30september
| drawingspace.py |
เพิ่มให้เรียกใช้ on_30september เพื่อนับจำนวน children ใน toolbox.py หลัง add_widget
| toolbox.py |
| toolbox.py |
| generaloption.py |
ข้อที่ 2 เมื่อ group แล้ว พอกด remove ให้ remove ที่เลือกทั้งหมด
| generaloption.py |
ไปแก้ไขในไฟล์ generaloption.py โดยการเพิ่มเงื่อนไข
if self.group_mode == True ให้ remove แบบ group นอกนั้นให้ remove แบบเดิม
โดยการ remove จะเช็คว่าโดนเลือกอยู่หรือไม่
ถ้าใช่ก็จะ remove
ที่วนเป็นแบบ reversed เพราะว่าหากวนแบบไปข้างหน้าเมื่อทำการ remove ไป 1 ตัว
[1,2,3,4] //remove
| < ตัวชี้
[2,3,4, ] // ตัวชี้จะชี้เลข 3 ซึ่งข้ามเลข 2 ไป เพราะว่า ตัวที่ 2,3,4 จะเลื่อนมาตำแหน่งตัว 1 ที่ถูก remove
|
หากเป็นแบบ reversed จะไม่ข้าม
ข้อที่ 3 นับ Stickman และไปแสดงใน statusbar
เมื่อใช้คำสั่งprint(str(type(child))) ดู พบว่า
![]() |
| ลอง print(str(type(child))) |
จึงนำมาใช้เช็คเงื่อนไขเพื่อนับ stickman ได้
![]() |
| drawingspace.py |
![]() |
| statusbar.py |
![]() |
| statusbar.kv |
วันศุกร์ที่ 30 กันยายน พ.ศ. 2559
Progress
- ทำ remove group เสร็จ
- แก้ไข count stickman ให้นับถูกต้อง
- ทำการ push ขึ้น bitbucket (https://bitbucket.org/nuttaphon_rodphakdeekul/quiz2)
- พิมพ์คำสั่ง hg push https://bitbucket.org/nuttaphon_rodphakdeekul/quiz2/
- ใส่ username และ password
- เข้าโฟลเดอร์ .hg และสร้างไฟล์ hgrc
- เข้าไป edit ไฟล์ hgrc แล้วแก้ไขดังนี้
[paths]วิธีการ pull
default = https://bitbucket.org/nuttaphon_rodphakdeekul/quiz2/
- พิมพ์คำสั่ง hg pull -u
วันจันทร์ที่ 5 กันยายน พ.ศ. 2559
วันพฤหัสบดีที่ 18 สิงหาคม พ.ศ. 2559
argument
วันอังคารที่ 16 สิงหาคม พ.ศ. 2559
Python
Odd Or Even
Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user. Hint: how does an even / odd number react differently when divided by 2?
code:
def setup():
num = int(input("Please enter num:"))
if num%2==0:
print(num,"is even")
else:
print(num,"is odd")
setup()
Guessing Game One
Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right.
code:
import random
def setup():
count=0
number = random.randint(1,9)
while True:
num = int(input("Please guess num between 1-9:"))
if num==number:
print(num," is correct")
print("your guess count is ",count)
break
else:
count+=1
if num>number:
print("it's too high")
else:
print("it's too low")
setup()
Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user. Hint: how does an even / odd number react differently when divided by 2?
code:
def setup():
num = int(input("Please enter num:"))
if num%2==0:
print(num,"is even")
else:
print(num,"is odd")
setup()
Guessing Game One
Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right.
code:
import random
def setup():
count=0
number = random.randint(1,9)
while True:
num = int(input("Please guess num between 1-9:"))
if num==number:
print(num," is correct")
print("your guess count is ",count)
break
else:
count+=1
if num>number:
print("it's too high")
else:
print("it's too low")
setup()
ex from http://www.practicepython.org/
วันจันทร์ที่ 15 สิงหาคม พ.ศ. 2559
Basic Python
ทบทวน Python
def setup():a = [-1,-2,3,5,8,4,10]
print(calc_postive_sum(a))
def calc_postive_sum(a):
sum = 0
for i in a:
if(i > 0):
sum+=i
return sum
setup()
การใช้ Class
class Person:def __init__(self,name,age):
self.name=name
self.age=age
def display(self):
print("Name:",self.name)
print("Age:",self.age)
def setup():
person1 = Person("John",20)
person2 = Person("Jan",19)
people = [person1,person2]
for i in people:
i.display()
setup()
built-in data structure
List
- Queue
- append
- Stack
- append
- pop
Sets
def setup():
a = [5,2,3,5,5,6,8,6,5,2]
a = remove_duplicate(a)
print(a)
def remove_duplicate(a):
return list(set(a))
setup()
วันศุกร์ที่ 12 สิงหาคม พ.ศ. 2559
วันพฤหัสบดีที่ 11 สิงหาคม พ.ศ. 2559
Install Ubuntu
File Commands
ls -al แสดงข้อมูลของไฟล์/โฟลเดอร์
cd เปลี่ยน directory
mkdir directory-name สร้างโฟลเดอร์
rm file-name ลบไฟล์
rm -r directory-name ลบโฟลเดอร์
cp file1 file2 คัดลอกfile1 ไป file2
cp -r dir1 dir2 copy โฟลเดอร์[dir1] ไปยัง โฟลเดอร์[dir2] (ถ้าไม่มี dir2 จะสร้างขึ้นเอง)
สมัครสมาชิก:
บทความ (Atom)
commit เพิ่มเติม : เพื่ม userstory, bookmark
>> add userstory ทำการเพิ่ม userstory ใน functional tests >> add bookmark for user เพิ่มระบบ Bookmark โดยการสร้าง model ขึ...
-
1 2 3 4 5 6 7 8 9 def setup (): print (d2b( 8 )) def d2b (num): x = "" while num > 0 : x = str ( int (n...
-
1 2 3 4 5 6 7 8 9 10 11 12 13 def test_layout_and_styling ( self ): # Edith goes to the home page self . brow...
-
การใช้ template inheritence คือการสืบทอดเทมเพลต เพื่อให้ไม่ต้องเขียนโค้ดหน้าเว็บๆซ้ำๆ เราจะมีหน้าหลักอันเดียว (base.html or parent) ภายในนั...















