WPF HSplit 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 hbox class WpfHSplit(): def __init__(self,lsize=1,rsize=1): self.box = hbox.WpfHBox() self.ctrl = self.box.ctrl self.box.ctrl.Margin = Thickness(1) self.widths = [ lsize, rsize ] def add_items(self,items,widths=None): if not widths: widths = self.widths self.box.add_item(items[0],width=widths[0],expand=True) self.box.add_splitter() self.box.add_item(items[1],width=widths[1],expand=True) if __name__ == "__main__": import win app = win.Win("HSplit Demo",320,240) b1 = Button(); b1.Content = "Left" b2 = Button(); b2.Content = "Right" hs = WpfHSplit(1,2) hs.add_items( (b1,b2) ) app.set_content(hs.ctrl) app.run()
댓글 없음:
댓글 쓰기