myBlog

IronPython, Silverlight, WPF, XAML, HTML5, ...

IronPythonで、自由にドラッグできる、電卓を作りました! 《 Drag Calc 》

2011-07-30 10:24:06 | IronPython
IronPython WPF サンプルの calc を myBlog用に変換しました。
下記のBlogを参考にして、Drag可能な、電卓(calc)にしました。
Blog: jimmy.thinking ⇒ Dragging elements in Silverlight with DLRConsole
http://blog.jimmy.schementi.com/2008/08/dragging-elements-in-silverlight-with.html

MSDN Blogs ⇒ 荒井省三のBlog ⇒ DLR Console を使って時計をドラッグするサンプル
http://blogs.msdn.com/b/shozoa/archive/2008/09/03/dragging-clock-on-dlr-console.aspx

Calc XAML⇒calc.xaml ⇒ 電卓(calc)
http://softgarden.lovepop.jp/myBlog/xaml/calc.xaml

Calc

#####################################################################################
#
#  Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Microsoft Public License. A 
# copy of the license can be found in the License.html file at the root of this distribution. If 
# you cannot locate the  Microsoft Public License, please send an email to 
# ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
# by the terms of the Microsoft Public License.
#
# You must not remove this notice, or any other, from this software.
#
#
#####################################################################################
#
# calculator.py
#
from System.Windows.Controls import *

def Walk(tree):
    yield tree
    if hasattr(tree, 'Children'):
        for child in tree.Children:
            for x in Walk(child):
                yield x
    elif hasattr(tree, 'Child'):
        for x in Walk(tree.Child):
            yield x
    elif hasattr(tree, 'Content'):
        for x in Walk(tree.Content):
            yield x

def enliven(w):
    try:
        controls = [ n for n in Walk(w) if isinstance(n, Button) or isinstance(n, TextBox) ]
        Calculator(controls)
    except:
        print "Function failed. Did you pass in the Calculator window?"

class Calculator:

    def __init__(self, controls):
        self.expression = ""

        for i in controls:
            if isinstance(i, Button):
                if hasattr(self, "on_" + i.Name):
                    print "Registering self.on_" + i.Name + " to handle " + i.Name + ".Click"
                    i.Click += getattr(self, "on_" + i.Name)
            elif isinstance(i, TextBox):
                if i.Name == "Result":
                    self.result = i
        self.result.Text = self.expression
        

    def on_Button(self, c):
        self.expression += c
        self.result.Text = self.expression

    def on_Clear(self, b, e):
        self.expression = ""
        self.result.Text = self.expression

    def on_Equals(self, b, e):
        try:
            result = str(eval(self.expression))
            self.result.Text = result
            self.expression = result
        except:
            self.result.Text = "<<ERROR>>"
            self.expression = ""

    def on_One(self, b, e):
        self.on_Button('1')
    def on_Nine(self, b, e):
        self.on_Button('9')
    def on_Eight(self, b, e):
        self.on_Button('8')
    def on_Five(self, b, e):
        self.on_Button('5')
    def on_Four(self, b, e):
        self.on_Button('4')
    def on_Two(self, b, e):
        self.on_Button('2')
    def on_Three(self, b, e):
        self.on_Button('3')
    def on_Six(self, b, e):
        self.on_Button('6')
    def on_Multiply(self, b, e):
        self.on_Button('*')
    def on_Seven(self, b, e):
        self.on_Button('7')
    def on_Subtract(self, b, e):
        self.on_Button('-')
    def on_Zero(self, b, e):
        self.on_Button('0')
    def on_DecimalPoint(self, b, e):
        self.on_Button('.')
    def on_Plus(self, b, e):
        self.on_Button('+')
    def on_Divide(self, b, e):
        self.on_Button('/')
#
# calc.py
# ipy.exe calc.py
# ipyw.exe calc.py
#
import clr
clr.AddReferenceByPartialName("PresentationFramework")
clr.AddReferenceByPartialName("PresentationCore")
clr.AddReference('WindowsBase')
from System import Object
from System.Windows.Markup import XamlReader
from System.Windows import Window, Application
from System.Windows.Controls import Canvas, Button, TextBox
from System.Windows.Media import Brushes
import calculator

def LoadXamlNet(strUrl):
    import System
    request = System.Net.WebRequest.Create(strUrl)
    response = request.GetResponse()
    dataStream = response.GetResponseStream()
    try:
        element = XamlReader.Load(dataStream)
    finally:
        dataStream.Close()
        response.Close()
    return element

def Walk(tree):
    yield tree
    if hasattr(tree, 'Children'):
        for child in tree.Children:
            for x in Walk(child):
                yield x
    elif hasattr(tree, 'Child'):
        for x in Walk(tree.Child):
            yield x
    elif hasattr(tree, 'Content'):
        for x in Walk(tree.Content):
            yield x

class Calc(Object):
    def __init__(self):
        self.scene = calc = LoadXamlNet("http://softgarden.lovepop.jp/myBlog/xaml/calc.xaml")

        controls = [ n for n in Walk(calc) if isinstance(n, Button) or isinstance(n, TextBox) ]
        for c in controls:
            c.FontSize *=2
        calculator.enliven(calc)

class Drag(object):
    def __init__(self, root, obj):
        self.click = None
        self.obj = obj
        self.root = root
    def OnMouseLeftButtonDown(self, sender, e):
        self.click = e.GetPosition(self.root)
        self.sx = Canvas.GetLeft(self.obj)
        self.sy = Canvas.GetTop(self.obj)
        if (self.sx.IsNaN(self.sx)): self.sx = 0.0
        if (self.sy.IsNaN(self.sy)): self.sy = 0.0
        self.obj.CaptureMouse()
    def OnMouseLeftButtonUp(self, sender, e):
        if(self.click != None):
            self.obj.ReleaseMouseCapture()
            self.click = None
    def OnMouseMove(self, sender, e):
        if(self.click != None):
            mouse_pos = e.GetPosition(self.root)
            Canvas.SetLeft(self.obj, (self.sx + mouse_pos.X - self.click.X))
            Canvas.SetTop(self.obj, (self.sy + mouse_pos.Y - self.click.Y))
    def enable(self):
         self.obj.MouseLeftButtonDown += self.OnMouseLeftButtonDown
         self.obj.MouseLeftButtonUp += self.OnMouseLeftButtonUp
         self.obj.MouseMove += self.OnMouseMove
    def disable(self):
         self.obj.MouseLeftButtonDown -= self.OnMouseLeftButtonDown
         self.obj.MouseLeftButtonUp -= self.OnMouseLeftButtonUp
         self.obj.MouseMove -= self.OnMouseMove

class ExWindow(Window):
    def __init__(self):
        self.Title = "Dynamic Languages Rock!"
        self.Width = 600
        self.Height = 480
        self.Content = canvas = Canvas(Background = Brushes.LightGray)
        self.calc = Calc().scene
        canvas.Children.Add (self.calc)
        Canvas.SetTop(self.calc, 60)
        Canvas.SetLeft(self.calc, 180)
        self.drag = Drag(root=canvas, obj=self.calc)
        self.drag.enable()

if __name__ == "__main__":
    win = ExWindow()
    Application().Run(win)

IronPythonの世界 (Windows Script Programming)
荒井 省三
ソフトバンク クリエイティブ
エキスパートPythonプログラミング
Tarek Ziade
アスキー・メディアワークス
Pythonスタートブック
辻 真吾
技術評論社

IronPythonで、XAMLから、ドックパネル( DockPanel )を表示

2011-07-06 17:11:52 | IronPython
今回は、シンプルなプログラムです。
IronPythonで、XAMLを使って、DockPanelを表示します。
普通のXAMLと、LastChildFill="False" を指定したXAMLです。

Blog: .NETな日々 ⇒ [WPF] WPF入門 ~レイアウト [DockPanel]~
http://blogs.wankuma.com/kzt/archive/2009/03/17/169777.aspx
を、参考にさせていただきました。[ .NETな日々 ]は良くできています。
サンプルが上手に使われていて、わかりやすいです。

#
# DockPanelTestFill.py

import clr
clr.AddReferenceByPartialName("PresentationFramework")
clr.AddReferenceByPartialName("PresentationCore")
from System import Object
from System.Windows import Window, Application
from System.Windows.Markup import XamlReader
xaml_str="""
<Window
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   Title="Window1" Height="300" Width="300"> 
    <DockPanel> 
        <Button DockPanel.Dock="Left">Left</Button> 
        <Button DockPanel.Dock="Top">Top</Button> 
        <Button DockPanel.Dock="Right">Right</Button> 
        <Button DockPanel.Dock="Bottom">Bottom</Button> 
        <Button DockPanel.Dock="Top">Fill</Button> 
    </DockPanel> 
</Window>
"""
class ExWindow(Object):
    def __init__(self):
        self.Root = win = XamlReader.Parse(xaml_str)
if __name__ == "__main__":
    win = ExWindow()
    Application().Run(win.Root)

#
# DockPanelTestNotFill.py
#
import clr
clr.AddReferenceByPartialName("PresentationFramework")
clr.AddReferenceByPartialName("PresentationCore")
from System import Object
from System.Windows import Window, Application
from System.Windows.Markup import XamlReader
xaml_str="""
<Window
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   Title="Window1" Height="300" Width="300"> 
    <DockPanel LastChildFill="False" > 
        <Button DockPanel.Dock="Left">Left</Button> 
        <Button DockPanel.Dock="Top">Top</Button> 
        <Button DockPanel.Dock="Right">Right</Button> 
        <Button DockPanel.Dock="Bottom">Bottom</Button> 
        <Button DockPanel.Dock="Top">Not Fill</Button> 
    </DockPanel> 
</Window>
"""
class ExWindow(Object):
    def __init__(self):
        self.Root = win = XamlReader.Parse(xaml_str)
if __name__ == "__main__":
    win = ExWindow()
    Application().Run(win.Root)

IronPythonの世界 (Windows Script Programming)
荒井 省三
ソフトバンク クリエイティブ
エキスパートPythonプログラミング
Tarek Ziade
アスキー・メディアワークス
Pythonスタートブック
辻 真吾
技術評論社

IronPythonで、図形とブラシ( Shape, Brush )を動的に作成

2011-07-05 13:09:30 | IronPython
タブ・コントロール TabControl に、図形・ブラシを動的に作成
BLOG: 続・ひよ子のきもち
2008-10-13 第4章 ブラシ 1/5, LinearGradientBrush
http://d.hatena.ne.jp/kotsubu-chan/20081013
2008-05-12 第2章 TabControl 1/1
http://d.hatena.ne.jp/kotsubu-chan/20080512
等複数のページから、 XAMLとIronPythonのコード を myBlog 用に少しアレンジしています。

続・ひよ子のきもち は、本当に興味深いPageです。
WPF・IronPython・OOP について、色々と教えてもらいました。

Exbrush

#
# exBrush.py
#
import clr
clr.AddReferenceByPartialName("PresentationFramework")
clr.AddReferenceByPartialName("PresentationCore")
clr.AddReference('WindowsBase') # for Point, Rect

from System import Object, Uri, UriKind
from System.Windows.Markup import XamlReader
from System.Windows import (
        Window, Application, Point, Rect, LogicalTreeHelper, Thickness)
#from System.Windows.Controls import Canvas
from System.Windows.Media import (
        Color, Colors, SolidColorBrush, Brushes, PointCollection, DrawingGroup, DrawingBrush, 
        VisualBrush, ImageBrush, LinearGradientBrush, RadialGradientBrush, GradientStop,
        GeometryGroup, RectangleGeometry,TileMode,EllipseGeometry, GeometryDrawing)
from System.Windows.Media.Imaging import BitmapImage
from System.Windows.Shapes import Ellipse, Polygon

xaml_str="""
<TabControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <TabItem   Header="SolidColorBrush">
        <WrapPanel Name="solidColorBrush" />
    </TabItem>
    <TabItem   Header="LinearGradientBrush">
        <WrapPanel Name="linearGradientBrush" />
    </TabItem>
    <TabItem   Header="RadialGradientBrush">
        <WrapPanel Name="radialGradientBrush" />
    </TabItem>
    <TabItem   Header="ImageBrush">
        <WrapPanel Name="imageBrush" />
    </TabItem>
    <TabItem   Header="DrawingBrush">
        <WrapPanel Name="drawingBrush" />
    </TabItem>
    <TabItem   Header="VisualBrush">
        <WrapPanel Name="visualBrush" />
    </TabItem>
</TabControl>
"""
class ExWindow(Window):
    def __init__(self, Content=None, **args):
        for key,value in args.items():
            setattr(self,key,value)
        self.InitializeComponent(Content)
        self.init()

    def InitializeComponent(self, Content):
        self.Content = XamlReader.Parse(Content)
        
    def init(self):
        target = (
            "solidColorBrush",
            "linearGradientBrush",
            "radialGradientBrush",
            "imageBrush",
            "drawingBrush",
            "visualBrush",
            )
        self._Controls(target)

    def _Controls(self, target):
        for e in target:
            #c = LogicalTreeHelper.FindLogicalNode(self.Content, e)
            c = self.Content.FindName(e)
            setattr(self, e, c)
        for e in target:
            items = getattr(self, e)
            for shape in self.newEllipse(), self.newPolygon():
                shape.Fill = getattr(self, "_%s"%e)()
                items.Children.Add(shape)

    def _solidColorBrush(self):
        return Brushes.Yellow

    def _linearGradientBrush(self):
        brush = LinearGradientBrush()
        for color, offset in [
            ("Yellow", 0.0),    # follow me ..)^.^)
            ("Green" , 1.0),
            ]: 
            brush.GradientStops.Add(GradientStop(
                Color=getattr(Colors, color),
                Offset=offset,
                ))
        return brush

    def _radialGradientBrush(self):
        brush = RadialGradientBrush()
        for color, offset in [
            ("Yellow", 0.0),    # follow me ..)^.^)
            ("Green" , 1.0),
            ]: 
            brush.GradientStops.Add(GradientStop(
                Color=getattr(Colors, color),
                Offset=offset,
                ))
        return brush

    def _imageBrush(self):
        return ImageBrush(
            ImageSource = BitmapImage(Uri("http://softgarden.lovepop.jp/myBlog/image/j0182772.jpg")))
            #ImageSource= BitmapImage(Uri("j0182772.jpg", UriKind.Relative)))
    def _drawingBrush(self):
        brush = DrawingBrush(
            Viewport=Rect(0, 0, 0.1, 0.1),
            TileMode=TileMode.Tile,
            )
        sheet = GeometryDrawing(
            brush=Brushes.Yellow,
            pen=None,
            geometry=RectangleGeometry(Rect(0, 0, 50, 50)))
        geometry = GeometryGroup()
        for (px, py), rx, ry in (
            ((10, 10), 10, 10),
            ((35, 35), 15, 15),
            ):
            geometry.Children.Add(EllipseGeometry(
                Center=Point(px, py),
                RadiusX=rx,
                RadiusY=ry,
                ))
        marble = GeometryDrawing(
            brush=Brushes.Blue,
            pen=None,
            geometry=geometry)
        drawing = DrawingGroup()
        for e in sheet, marble:
            drawing.Children.Add(e)
        brush.Drawing = drawing
        return brush

    def _visualBrush(self):
        brush = VisualBrush()
        brush.Visual = self.imageBrush
        return brush

    def newEllipse(self):
        return Ellipse(
            Stroke=Brushes.Blue,
            StrokeThickness=2,
            Width=100,
            Height=50,
            )

    def newPolygon(self):
        points = PointCollection()
        vertices = "0,28 80,28 12,80 40,0 68,80"
        for e in vertices.split(" "):
            x, y = eval(e)
            points.Add(Point(x, y))
        return Polygon(
            Stroke=Brushes.Blue,
            StrokeThickness=2,
            Points=points,
            )

if __name__ == "__main__":
    win = ExWindow(Title="exBrush.py", Width=400, Height=200, Content=xaml_str)
    Application().Run(win)

IronPythonの世界 (Windows Script Programming)
荒井 省三
ソフトバンク クリエイティブ
エキスパートPythonプログラミング
Tarek Ziade
アスキー・メディアワークス
Pythonスタートブック
辻 真吾
技術評論社

IronPythonで、グラデーション色を変更できるボタンを作りました

2011-07-02 01:55:08 | IronPython

IronPythonで、動的にグラデーション色を変更できるボタンを作成。

Yamada Program Blogから グラデーション色を変更できるボタンテンプレート ( http://yamada-program.blogspot.com/2011/04/wpf.html ) を参考にさせていただきました。 C#のプログラムをIronPythonに変換しました。とても、勉強になる。 IValueConverter, Binding.Converter, ControlTemplate, TemplateBinding, TemplateBindingExtension を使用。

Dynamicgradientbutton

#
# DynamicGradientButton.py
#
import clr
clr.AddReferenceByPartialName("PresentationFramework")
clr.AddReferenceByPartialName("PresentationCore")
clr.AddReference('WindowsBase')

from System import Object
from System.Windows.Markup import XamlReader
from System.Windows import (Window, Application, Point, Style, Setter, 
                            FrameworkElementFactory, TemplateBindingExtension,
                            HorizontalAlignment, VerticalAlignment, Thickness )
from System.Windows.Controls import ( TextBox, Button, Grid,
                                      ControlTemplate, ContentPresenter )
from System.Windows.Media import (LinearGradientBrush, GradientStop, 
                                  Color, Colors, SolidColorBrush, Brushes )
from System.Windows.Shapes import Ellipse
from System.Windows.Data import Binding, BindingOperations, IValueConverter

xaml_str="""
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"> 

    <StackPanel x:Name="sp1">
        <Button x:Name="bt1" Content="Button1" Background="Red"/> 
        <Button x:Name="bt2" Content="Button2" Background="Green"/> 
        <Button x:Name="bt3" Content="Button3" Background="Blue"/>
    </StackPanel> 
</Window>
"""

class Brush2ColorConverter(IValueConverter):
    def Convert(self, value, targetType, parameter, culture):
        sb = value # as SolidColorBrush;
        if (sb != None):
             return sb.Color
        else:
            return Colors.White

    def ConvertBack(self,value, TargetType, parameter, culture):
       #throw new NotImplementedException();
       return Binding.DoNothing

class ExWindow(Object):
    def __init__(self):
        win = XamlReader.Parse(xaml_str)
        self.Root = win
        self.bt1= win.FindName("bt1")
        self.bt2= win.FindName("bt2")
        self.bt3= win.FindName("bt3")
 
        style = self.setButtonStyle()
        win.Resources.Add(Button().GetType(), style)

        self.bt1.Click += self.bt1_Click
        self.i = 0

    def setButtonStyle(self):
        myButtonStyle = Style( Button().GetType() )
        #--- temmplate start ------
        template = ControlTemplate( TargetType=Button )
        elemFactory = FrameworkElementFactory(Grid)
        template.VisualTree = elemFactory
        elemFactory1 = FrameworkElementFactory(Ellipse)
        elemFactory1.SetValue(Ellipse.DataContextProperty,
            TemplateBindingExtension(Button.BackgroundProperty))
        elemFactory1.SetValue(Ellipse.StrokeProperty,
            TemplateBindingExtension(Button.BackgroundProperty) )
        brush = LinearGradientBrush(StartPoint = Point(0.5, 0.0), 
                                    EndPoint = Point(0.5, 1.0) )
        grStop = GradientStop( Offset= 0.0 )
        BindingOperations.SetBinding(grStop, GradientStop.ColorProperty,
            Binding( Converter = Brush2ColorConverter() ) )
        brush.GradientStops.Add( grStop )
        brush.GradientStops.Add( GradientStop(Colors.White, 1.0) )
        elemFactory1.SetValue(Ellipse.FillProperty, brush )
        elemFactory.AppendChild(elemFactory1)
        elemFactory2 = FrameworkElementFactory(ContentPresenter)
        elemFactory2.SetValue(ContentPresenter.HorizontalAlignmentProperty,
                              HorizontalAlignment.Center)
        elemFactory2.SetValue(ContentPresenter.VerticalAlignmentProperty,
                              VerticalAlignment.Center)
        elemFactory.AppendChild(elemFactory2)
        #--- temmplate end ------
        setter = Setter()
        setter.Property = Button.TemplateProperty
        setter.Value = template
        myButtonStyle.Setters.Add(setter)
        myButtonStyle.Setters.Add(
            Setter(Property = Button.WidthProperty,Value = 80.0 ) )
        myButtonStyle.Setters.Add(
            Setter(Property = Button.HeightProperty, Value = 25.0) )
        myButtonStyle.Setters.Add(
            Setter(Property = Button.MarginProperty, Value = Thickness(5.0)) )
        myButtonStyle.Setters.Add(
            Setter(Property = Button.ForegroundProperty, Value = Brushes.White ) )
        return myButtonStyle

    def bt1_Click(self,sender,e):
        i = self.i % 3
        if i == 0 :
            self.bt2.Background = Brushes.Lime
            self.bt3.Background = Brushes.Black
        elif i == 1 :
            self.bt2.Background = Brushes.Orange
            self.bt3.Background = Brushes.Green
        else:
            self.bt2.Background = Brushes.Blue
            self.bt3.Background = Brushes.Red
        self.i += 1

if __name__ == "__main__":
    win = ExWindow()
    Application().Run(win.Root)

IronPythonの世界 (Windows Script Programming)
荒井 省三
ソフトバンク クリエイティブ
エキスパートPythonプログラミング
Tarek Ziade
アスキー・メディアワークス
Pythonスタートブック
辻 真吾
技術評論社

IronPythonでColorComboBoxをつくりました

2011-07-01 23:21:17 | IronPython

IronPythonで色を選択するComboBoxをつくりました.。

XAML と IronPythonを1つのファイルに、まとめています。

Colorcombobox

#
# ColorComboBox.py
#
import clr
clr.AddReferenceByPartialName("PresentationFramework")
clr.AddReferenceByPartialName("PresentationCore")
clr.AddReference('WindowsBase')

from System import Object
from System.Windows.Markup import XamlReader
from System.Windows import Window, Application, CornerRadius, Thickness
from System.Windows.Controls import (StackPanel, Border, Orientation,
                    ComboBoxItem, ComboBoxItem, TextBlock )
from System.Windows.Media import Color, Colors, SolidColorBrush, Brushes

xaml_str="""
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Color ComboBox" Height="62" Width="220" >
  <ComboBox Name="comboBox1" Height ="25" MaxDropDownHeight="338"/>
</Window>
"""

class ExWindow(Object):
    def __init__(self):
        win = XamlReader.Parse(xaml_str)
        self.Root = win
        self.comboBox1 = win.FindName("comboBox1")
        win.Loaded += self.window1_Loaded

    def window1_Loaded(self, sender, e):
        self.SetupComboBox()
        if (self.comboBox1.Items.Count > 0):
           self.comboBox1.SelectedIndex = 0

    def SetupComboBox(self):
        item = ComboBoxItem()

        infs=[]
        for name in dir(Colors):
            c = getattr(Colors, name)
            if isinstance(c, Color):
                infs.append([name, SolidColorBrush(c)])

        for name, col in infs:
            brush = col
            item = ComboBoxItem()

            panel = StackPanel()
            panel.Orientation = Orientation.Horizontal

            border = Border()
            border.Background = brush
            border.CornerRadius = CornerRadius(3)
            border.Width = 30
            border.Height = 12
            border.BorderBrush = Brushes.Black
            border.BorderThickness = Thickness(1)

            block = TextBlock()
            block.Text = name
            block.Width = self.comboBox1.Width - border.Width - 20
            block.Margin = Thickness(10, 0, 0, 0)

            panel.Children.Add(border)
            panel.Children.Add(block)

            item.Content = panel
            self.comboBox1.Items.Add(item)

if __name__ == "__main__":
    win = ExWindow()
    Application().Run(win.Root)

IronPythonの世界 (Windows Script Programming)
荒井 省三
ソフトバンク クリエイティブ
エキスパートPythonプログラミング
Tarek Ziade
アスキー・メディアワークス
Pythonスタートブック
辻 真吾
技術評論社