예제 #1
0
파일: main.py 프로젝트: madlinux/ironpython
    def setup_post_panel(self):
        self.bottom_panel.Children.Clear()
                
        entry_pane = TextBox()
        entry_pane.AcceptsReturn = True
        entry_pane.Width = 275
        entry_pane.Height = 75
        entry_pane.FontSize = 14
        entry_pane.Margin = Thickness(2)
        entry_pane.TextChanged += self.setCharsMsg
        entry_pane.TextWrapping = TextWrapping.Wrap
        
        self.entry_pane = entry_pane
        
        button = Button()
        button.Content = ' Post '
        self.bottom_panel.Children.Add(entry_pane)
        self.bottom_panel.Children.Add(button)

        self.button = button
        button.Click += self.onPost
        button.Margin = Thickness(2)

        self.msg = TextBlock()
        self.msg.FontSize = 14
        self.msg.HorizontalAlignment = HorizontalAlignment.Center
        self.msg.VerticalAlignment = VerticalAlignment.Center
        self.bottom_panel.Children.Add(self.msg)
        self.setCharsMsg(None, None)
예제 #2
0
    def nui_skeleton_frame_ready(self, sender, e):
        skeletonFrame = e.SkeletonFrame
        self.skeleton.Children.Clear()

        for data in skeletonFrame.Skeletons:
            if SkeletonTrackingState.Tracked == data.TrackingState:
                for joint in data.Joints:
                    if joint.ID == JointID.Head:
                        jointPos = self.getDisplayPosition(joint)

                        self.lastX = jointPos.X
                        self.foundHead = True

        if self.foundHead:
            bubble = Image()
            #imageSource = System.Windows.Resources["think"]
            bubble.Source = self.thinkBubble
            bubble.SetValue(Canvas.TopProperty, self.lastY)
            bubble.SetValue(Canvas.LeftProperty, self.lastX)
            self.skeleton.Children.Add(bubble)

            text = TextBox()
            text.Text = "Hello World!"
            text.FontSize = 50
            text.FontWeight = FontWeights.Bold
            text.BorderThickness = Thickness(0)
            text.SetValue(Canvas.TopProperty, self.lastY + 120)
            text.SetValue(Canvas.LeftProperty, self.lastX + 60)
            self.skeleton.Children.Add(text)
예제 #3
0
    def nui_skeleton_frame_ready(self, sender, e):
        skeletonFrame = e.SkeletonFrame
        self.skeleton.Children.Clear()

        for data in skeletonFrame.Skeletons:
            if SkeletonTrackingState.Tracked == data.TrackingState:
                for joint in data.Joints:
                    if joint.ID == JointID.Head:
                        jointPos = self.getDisplayPosition(joint)

                        self.lastX = jointPos.X
                        self.foundHead = True

        if self.foundHead:
            bubble = Image()
            #imageSource = System.Windows.Resources["think"]
            bubble.Source = self.thinkBubble
            bubble.SetValue(Canvas.TopProperty, self.lastY)
            bubble.SetValue(Canvas.LeftProperty, self.lastX)
            self.skeleton.Children.Add(bubble)

            text = TextBox()
            text.Text = "Hello World!"
            text.FontSize = 50
            text.FontWeight = FontWeights.Bold
            text.BorderThickness = Thickness(0)
            text.SetValue(Canvas.TopProperty, self.lastY + 120)
            text.SetValue(Canvas.LeftProperty, self.lastX + 60)
            self.skeleton.Children.Add(text)
예제 #4
0
파일: main.py 프로젝트: madlinux/ironpython
    def populate_login_panel(self):
        button = Button()
        button.Content = '  Login  '
        button.FontSize = 16
        button.Margin = Thickness(5, 5, 5, 5)
        button.HorizontalAlignment = HorizontalAlignment.Stretch
        
        remember_me = CheckBox()
        remember_me.IsChecked = True
        remember_me.Margin = Thickness(5, 5, 5, 5)
        remember_me.Content = 'Remember'
        
        button_pane = StackPanel()
        button_pane.Children.Add(button)
        button_pane.Children.Add(remember_me)

        username = TextBox()
        username.FontSize = 16
        username.Width = 200
        username.Margin = Thickness(5, 5, 5, 5)

        password = PasswordBox()
        password.FontSize = 16
        password.Width = 200
        password.Margin = Thickness(5, 5, 5, 5)
        
        def HandleEnterKey(s, event):
            if event.Key == Key.Enter:
                event.Handled = True
                self.onLogin(None, None)
        
        password.KeyDown += HandleEnterKey
        if CheckStored():
            stored_username, stored_password = GetStored()
            username.Text = stored_username
            password.Password = stored_password

        entry_panel = StackPanel()
        entry_panel.HorizontalAlignment = HorizontalAlignment.Stretch
        entry_panel.Children.Add(username)
        entry_panel.Children.Add(password)

        self.bottom_panel.Children.Add(entry_panel)
        self.bottom_panel.Children.Add(button_pane)

        self.button = button
        self.remember_me = remember_me
        self.username_box = username
        self.password_box = password
        button.Click += self.onLogin
        
        self.msg = TextBlock()
        self.msg.Text = '      Login       '
        self.msg.FontSize = 16
        self.msg.HorizontalAlignment = HorizontalAlignment.Center
        self.msg.VerticalAlignment = VerticalAlignment.Center
        self.bottom_panel.Children.Add(self.msg)
예제 #5
0
    def on_loaded(self, s, e):
        bubble = Image()
        bubble.Name = "Bubble"
        #imageSource = System.Windows.Resources["think"]
        bubble.Source = self.thinkBubble
        bubble.SetValue(Canvas.TopProperty, self.currentY)
        bubble.SetValue(Canvas.LeftProperty, self.currentX)
        self.mainPanel.Children.Add(bubble)

        text = TextBox()
        text.Text = "???"
        text.FontSize = 65
        text.FontWeight = FontWeights.Bold
        text.BorderThickness = Thickness(0)
        text.SetValue(Canvas.TopProperty, self.currentY + 35)
        text.SetValue(Canvas.LeftProperty, self.currentX + 55)
        self.mainPanel.Children.Add(text)

        myDoubleAnimation = DoubleAnimation()
        myDoubleAnimation.From = 770.0
        myDoubleAnimation.To = 250.0

        myDoubleAnimation.Duration = Duration(TimeSpan.FromSeconds(3))

        myDoubleAnimationText = DoubleAnimation()
        myDoubleAnimationText.From = 770.0 + 35.0
        myDoubleAnimationText.To = 250.0 + 35.0

        myDoubleAnimationText.Duration = Duration(TimeSpan.FromSeconds(3))

        #myStoryboard = Storyboard()
        #myStoryboard.Children.Add(myDoubleAnimation)
        #Storyboard.SetTargetName(myDoubleAnimation, bubble.Name)
        #Storyboard.SetTargetProperty(myDoubleAnimation, PropertyPath(Canvas.TopProperty))

        #myStoryboard.Begin(self);

        bubble.BeginAnimation(Canvas.TopProperty, myDoubleAnimation)
        text.BeginAnimation(Canvas.TopProperty, myDoubleAnimationText)
예제 #6
0
    def on_loaded(self, s, e):
        bubble = Image()
        bubble.Name = "Bubble"
        #imageSource = System.Windows.Resources["think"]
        bubble.Source = self.thinkBubble
        bubble.SetValue(Canvas.TopProperty, self.currentY)
        bubble.SetValue(Canvas.LeftProperty, self.currentX)
        self.mainPanel.Children.Add(bubble)

        text = TextBox()
        text.Text = "???"
        text.FontSize = 65
        text.FontWeight = FontWeights.Bold
        text.BorderThickness = Thickness(0)
        text.SetValue(Canvas.TopProperty, self.currentY + 35)
        text.SetValue(Canvas.LeftProperty, self.currentX + 55)
        self.mainPanel.Children.Add(text)

        myDoubleAnimation = DoubleAnimation()
        myDoubleAnimation.From = 770.0;
        myDoubleAnimation.To = 250.0;

        myDoubleAnimation.Duration = Duration(TimeSpan.FromSeconds(3))

        myDoubleAnimationText = DoubleAnimation()
        myDoubleAnimationText.From = 770.0 + 35.0;
        myDoubleAnimationText.To = 250.0 + 35.0;

        myDoubleAnimationText.Duration = Duration(TimeSpan.FromSeconds(3))

        #myStoryboard = Storyboard()
        #myStoryboard.Children.Add(myDoubleAnimation)
        #Storyboard.SetTargetName(myDoubleAnimation, bubble.Name)
        #Storyboard.SetTargetProperty(myDoubleAnimation, PropertyPath(Canvas.TopProperty))

        #myStoryboard.Begin(self);

        bubble.BeginAnimation(Canvas.TopProperty, myDoubleAnimation)
        text.BeginAnimation(Canvas.TopProperty, myDoubleAnimationText)
예제 #7
0
파일: app.py 프로젝트: madlinux/ironpython
textblock.FontSize = 18
textblock.Text = 'Stuff goes here'
root.Children.Add(textblock)

panel = StackPanel()
panel.Margin = Thickness(20)
panel.Orientation = Orientation.Horizontal

button = Button()
button.Content = 'Push Me'
button.FontSize = 18
button.Margin = Thickness(10)

textbox = TextBox()
textbox.Text = "Type stuff here..."
textbox.FontSize = 18
textbox.Margin = Thickness(10)
textbox.Width = 200
#textbox.Watermark = 'Type Something Here'

def onClick(s, e):
    textblock.Text = textbox.Text
    textbox.Text = ""
	
def onKeyDown(sender, e):
    if e.Key == Key.Enter:
        e.Handled = True
        onClick(None, None)
	
button.Click += onClick
textbox.KeyDown += onKeyDown