関連記事
- 2008-04-07 気軽に Swing《4》JPanel: グループリーグ 1/5
《付録》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">
<ItemsPanelTemplate>
《ここに引越中》2008年5月16日(金)
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.selectionChangeddef _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