2020년 8월 17일 월요일

[IronPython] WPF Controls - Label

 1. WPF Controls Label

import clr
clr.AddReference("PresentationFramework")
clr.AddReference("PresentationCore")

from System.Windows import *
from System.Windows.Controls import *
from System.Windows.Media.Effects import *

def GetToolTip(title):
    tip = ToolTip()
    tip.Content = title
    return tip
    
def GetLabel(title,size):
    l = Label()
    l.Content = title
    l.FontSize = size
    l.Margin  = Thickness(5)
    l.Padding = Thickness(5)
    l.HorizontalAlignment = HorizontalAlignment.Center;
    l.VerticalAlignment = VerticalAlignment.Center;
    l.BitmapEffect = DropShadowBitmapEffect()
    l.ToolTip = GetToolTip(title)
    return l
    
if __name__ == "__main__":     
    w = Window()
    w.Title = "Hello World"
    w.Width = 320
    w.Height = 240
    w.Content = GetLabel("Hello World",30)
    Application().Run(w)    





댓글 없음:

댓글 쓰기