WPF Date Picker
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.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 ctrl
class WpfDate(ctrl.WpfCtrl):
def __init__(self,handler=None,**kwargs):
self.ctrl = DatePicker()
self.init(**kwargs)
if handler: self.ctrl.SelectedDateChanged += handler
def get_value(self):
return self.ctrl.Text
def set_value(self,v):
self.ctrl.Text = v
date_ctrl = None
if __name__ == "__main__":
def date_handler(s,e): print(s.Text)
def button_handler(s,e):print( date_ctrl.set_value("1900-01-31" ) )
import win
app = win.Win("Date Picker Demo",320,240)
date_ctrl = WpfDate(date_handler)
app.set_content(date_ctrl.ctrl)
b = Button(); b.Content = "Button"; b.Click += button_handler
app.add_statusbar(b)
app.run()
댓글 없음:
댓글 쓰기