《付録》exWorldCup.py


<!--
# Copyright (C) 2000-2008, (^.^) piyo-piyo Tamago-Club
#
# History: WPF examples
# 2008/01/25, IronPython 1.1.1 (download)
# 2008/08/22, IronPython 1.1.2 (download)
# 2008/03/16, ver.2.0, WPF
# 2008/00/00, ver.2.1, IronPython 1.1.2

    • >

<DockPanel LastChildFill="False"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/sparkle">









《準備中》2008年10月13日(月)

2008年10月13日(月) C#.use(better, IronPython="WPF")` linearGradientBrush
2008年10月14日(火) C#.use(better, IronPython="WPF")` "radialGradientBrush",
2008年10月15日(水) C#.use(better, IronPython="WPF")` "imageBrush",
2008年10月16日(木) C#.use(better, IronPython="WPF")` "drawingBrush",
2008年10月17日(金) C#.use(better, IronPython="WPF")` "visualBrush",

C#.use(better, IronPython=”WPF”) 記事一覧
テンプレート

《著》本間りす《監修》小泉ひよ子とタマゴ倶楽部

《付録》exWorldCup.py


# -*- coding: utf-8 -*-
#===============================================================================
# Copyright (C) 2000-2008, 小泉ひよ子とタマゴ倶楽部
#
# History: WPF examples
# 2008/01/25, IronPython 1.1.1 (download)
# 2008/08/22, IronPython 1.1.2 (download)
# 2008/03/16, ver.2.0, WPF
# 2008/00/00, ver.2.1, IronPython 1.1.2
#===============================================================================
from _ant import *
from System import *
from System.Windows import *
from System.Windows.Media import *
from System.Windows.Media.Imaging import *

## --------------------
class ExWindow(Window):
def __init__(self, Content=None, **args):
self.InitializeComponent(Content)
self.init()

def InitializeComponent(self, Content):
self.Content = LoadXaml(Content)

def init(self):
target = "listBox", "colorBox"
self._Controls(target)
for e in self.teams():
self.listBox.Items.Add(e)
self.listBox.SelectionChanged += self.selectionChanged

def _Controls(self, target):
controls = xaml_controls(self)
for e in target:
setattr(self, e, controls[e])

def teams(self):
return [
"GER", "ECU", "POL", "CRC", # Group A
"ENG", "SWE", "PAR", "TRI", # Group B
"ARG", "NED", "CIV", "SCG", # Group C
"POR", "MEX", "ANG", "IRN", # Group D
"ITA", "GHA", "CZE", "USA", # Group E
"BRA", "AUS", "CRO", "JPN", # Group F
"SUI", "FRA", "KOR", "TOG", # Group G
"ESP", "UKR", "TUN", "KSA", # Group H
]

def selectionChanged(self, sender, e):
s = sender.SelectedItem
self.colorBox.Background = ImageBrush(
ImageSource=BitmapImage(Uri("image/%s.gif"%s, UriKind.Relative)))

## --------------------
if __name__ == "__main__":
xaml = __file__.replace(".py",".xaml")
win = ExWindow(
Title=xaml,
Width=250, Height=112,
Content=xaml,
)
Application().Run(win)

## --------------------


1/4