gui.py
#!C:/Python25/pythonおおお~
from Tkinter import *
widget = Label(None, text='Hello GUI world!')
widget.pack()
widget.mainloop()
pack() とか mainLoop() とかをコメントアウトして動かしてみる・・・ふむふむ。
WindowシステムはCでWindowsプログラミングしたときとおんなじ感じなんかな???
TkとかTclとかは全然しらん♪
#!C:/Python25/pythonおおお~
from Tkinter import *
widget = Label(None, text='Hello GUI world!')
widget.pack()
widget.mainloop()
#!C:/Python25/python
def scanner(name, function):
file = open(name, 'r')
while 1:
line = file.readline()
if not line: break
function(line)
file.close()
#!C:/Python25/python
from scanfile import scanner
def processLine(line):
if line[0] == '*':
print "Ms.", line[1:-1]
elif line[0] == '+':
print "Mr.", line[1:-1]
else:
raise 'unknown command', line
scanner("../res/people.txt", processLine)
Traceback (most recent call last):
hello world
File "C:\eclipse35Python\workspace\test\src\commands.py", line 12, in
scanner("../res/people.txt", processLine)
File "C:\eclipse35Python\workspace\test\src\scanfile.py", line 10, in scanner
function(line)
TypeError: processLine() takes exactly 2 arguments (1 given)
#!C:/Python25/python
from apptools import StreamApp
from textpack import marker
class PackApp(StreamApp):
def start(self):
if not self.args:
self.exit('use: packapp.py [-o target]? src src...')
Traceback (most recent call last):
File "./src/PackApp.py", line 2, in
from apptools import StreamApp
ImportError: No module named apptools
#!C:/Python31/python
import sys
marker = '::::::'
for name in sys.argv[1:]:
input = open(name, 'r')
print (marker + name)
print (input.read(),)
Traceback (most recent call last):
File "./src/packer.py", line 8, in
print (input.read(),)
UnicodeDecodeError: 'cp932' codec can't decode bytes in position 17-18: illegal
multibyte sequence
Windowsでの正しい文字コード。
Windowsの文字コードは、一般的には「シフトJIS」だが、正しくは「CP932」である。
「MS932」とも言う。
print 'Hello World';
print ('Hello World');
Hello World