2020년 12월 5일 토요일

[IronPython] WPF VSplit Layout

WPF VSplit Layout

import clr
clr.AddReference("PresentationFramework")
clr.AddReference("PresentationCore");
clr.AddReference('System.Data')
clr.AddReference('System.Windows.Forms')

import System
from System import *
from System.Data import *
from System.Type import GetType
from System.Threading.Tasks import Task
from System.Windows import *
from System.Windows.Controls import *
from System.Windows.Controls.Primitives import *
from System.Windows.Media import *
from System.Windows.Media.Imaging import *
from System.Windows.Media.Effects import *
from System.Windows.Shapes import Rectangle
from System.Windows.Data import Binding
from System.Windows.Ink import Stroke
from System.Windows.Forms import ( FolderBrowserDialog, DialogResult )
from Microsoft.Win32 import ( OpenFileDialog, SaveFileDialog )

import vbox 

class WpfVSplit():
    def __init__(self,lsize=1,rsize=1):
        self.box = vbox.WpfVBox()
        self.ctrl = self.box.ctrl
        self.box.ctrl.Margin = Thickness(1)
        self.heights = [ lsize, rsize ]
    def add_items(self,items,heights=None):
        if not heights: heights = self.heights
        self.box.add_item(items[0],height=heights[0],expand=True)
        self.box.add_splitter()
        self.box.add_item(items[1],height=heights[1],expand=True)

if __name__ == "__main__":
    import win
    app = win.Win("VSplit Demo",320,240)
    b1 = Button(); b1.Content = "Top"
    b2 = Button(); b2.Content = "Bottom"
    hs = WpfHSplit(4,1)
    hs.add_items( (b1,b2) )
    app.set_content(hs.ctrl)
    app.run()
    

댓글 없음:

댓글 쓰기