예제 #1
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)
예제 #2
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)
예제 #3
0
class InputDialog(_WpfDialog):
    def __init__(self, message, default='', hidden=False):
        _WpfDialog.__init__(self, message, default, hidden=hidden)

    def _create_selector(self, default, hidden):
        if hidden:
            self._entry = PasswordBox()
            self._entry.Password = default if default else ''
        else:
            self._entry = TextBox()
            self._entry.Text = default if default else ''
        self._entry.SetValue(Grid.RowProperty, 1)
        self._entry.SetValue(Grid.ColumnSpanProperty, 2)
        self.Margin = Thickness(10)
        self._entry.Height = 30
        self._entry.Width = 150
        self._entry.SelectAll()
        return self._entry

    def _get_value(self):
        try:
            return self._entry.Text
        except AttributeError:
            return self._entry.Password