Animating wx.TextCtrl and Inserting a hyperlink

Hello,

I am trying to port the Synfig UI (i.e synfig-studio) to wxPython.

For the AboutBox GUI, I noticed that GTK has some very cool features (e.g hyperlink in a text control, text control is able to glide upwards when you click a button to display it)

However, I have been able to create my own wx AboutDialog with all the features offered by the GTK equivalent. The only thing left are the animated license and credit text boxes and the hyperlink in the text box.

I don’t want to use the wx html Window. Is there a way of including a hyperlink in a TextCtrl?

Secondly, how can I animate the TextCtrl to glide up when it is displayed?

Thirdly, how can I animate the text to scroll up in the wx.TextCtrl?

Code attached with screen shot of what I am trying to achieve. You might have to download Synfig (http://www.synfig.org/cms/) to see the animated credits and license text boxes of the About Synfig Studio widget.

Thanks.

Regards,

Austin

synfig-gtk-original-version.PNG

synfig-wxpy-version.PNG

synfig_icon.png

dialog_test.py (9.47 KB)

synfig_icon.ico

The regular text control widget doesn’t really support hyperlinks, but the RichTextCtrl does. The TextCtrl does have a rich text mode, but I couldn’t find any information about whether it had support for hyperlinks. I don’t know how to get the animations you want. But one of the other guys on the list might.

Mike

···

On Sunday, December 13, 2015 at 8:43:33 AM UTC-6, austin aigbe wrote:

Hello,

I am trying to port the Synfig UI (i.e synfig-studio) to wxPython.

For the AboutBox GUI, I noticed that GTK has some very cool features (e.g hyperlink in a text control, text control is able to glide upwards when you click a button to display it)

However, I have been able to create my own wx AboutDialog with all the features offered by the GTK equivalent. The only thing left are the animated license and credit text boxes and the hyperlink in the text box.

I don’t want to use the wx html Window. Is there a way of including a hyperlink in a TextCtrl?

Secondly, how can I animate the TextCtrl to glide up when it is displayed?

Thirdly, how can I animate the text to scroll up in the wx.TextCtrl?

Code attached with screen shot of what I am trying to achieve. You might have to download Synfig (http://www.synfig.org/cms/) to see the animated credits and license text boxes of the About Synfig Studio widget.

Thanks.

Regards,

Austin

Check out the FloatCanvas in the wx Demo. Here is an old post:

Marquee Scrolling of Text?
<http://wxwidgets.10942.n7.nabble.com/Marquee-Scrolling-of-Text-td14591.html>

What I actually want is for the TextCtrl widget itself to scroll up while displaying.

I am not interested in animating the text in the TextCtrl. I want to animate the TextCtrl widget to appear gradually from bottom to top.

Thanks.

···

On Tue, Jan 12, 2016 at 4:44 PM, Dev Player devplayer@gmail.com wrote:

You received this message because you are subscribed to a topic in the Google Groups “wxPython-users” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/Rs0ASUzidGk/unsubscribe.

To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Check out the FloatCanvas in the wx Demo. Here is an old post:

Marquee Scrolling of Text?

Perhaps this is a starting point:

AutoShrinkWidget http://pastebin.com/9VfsifGK

Thanks. Exactly what I was looking for.

···

On Sun, Jan 17, 2016 at 9:51 AM, DevPlayer devplayer@gmail.com wrote:

Perhaps this is a starting point:

AutoShrinkWidget http://pastebin.com/9VfsifGK

You received this message because you are subscribed to a topic in the Google Groups “wxPython-users” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/Rs0ASUzidGk/unsubscribe.

To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

I see you got your answer, but it occurs to me to ask: why do you want
this? Offhand, I don't see the UX benefit of this effect. For what it's
worth, I myself have never liked a part of a screen I am trying to read
that is moving on its own (and I've read similar critiques on forums).

···

On Wed, Jan 13, 2016 at 11:03 AM, austin aigbe <eshikafe@gmail.com> wrote:

What I actually want is for the TextCtrl widget itself to scroll up while
displaying.

I am not interested in animating the text in the TextCtrl. I want to
animate the TextCtrl widget to appear gradually from bottom to top.

Sure it does. On windows mostly I believe. I think somehow it works with linux gtk.

    self.gTextCtrl = tc = wx.TextCtrl(self, wx.ID_ANY, '',
                                      style=wx.BORDER_SUNKEN |
                                            wx.TE_MULTILINE |
                                            wx.TE_NOHIDESEL |
                                            wx.TE_RICH2 | wx.TE_AUTO_URL |
                                            wx.TE_READONLY
                                            )
    # In case user for example creates the dialog then sets the font
    # on the dialog or the textctrl(maybe the user needs a mono font...)
    # we need to update the message so the auto url shows up and works right.
    # so we will override SetFont.
    tc.SetFont = self.SetFont
    tc.SetValue(message)  # Update AutoURL after creation.
    tc.Bind(wx.EVT_TEXT_URL, self.OnTextURL)
    tc.SetHelpText(_(u'This is the scrolled message dialog text.'))

def SetFont(self, font):
    """
    Sets the font for this window.

    SetFont(self, Font font) -> bool

    :param `font`:
    :type `font`: `wx.Font`
    :returns: Whether the font was successfully set.
    :rtype: bool
    """
    print(self)
    boolean = super(wx.TextCtrl, self.gTextCtrl).SetFont(font)
    self.gTextCtrl.SetValue(self.gTextCtrl.GetValue())
    return boolean

def OnTextURL(self, event):
    """
    Handles the ``wx.EVT_TEXT_URL`` event for :attr:`gTextCtrl`

    :param `event`: A `wx.TextURLEvent` to be processed.
    :type `event`: `wx.TextURLEvent`
    """
    mouseEvent = event.GetMouseEvent()
    if mouseEvent.LeftDClick():
        urlStart = event.GetURLStart()
        urlEnd = event.GetURLEnd()
        url = self.gTextCtrl.GetRange(urlStart, urlEnd)
        webbrowser.open_new_tab(url)

``

···

On Tuesday, December 15, 2015 at 9:03:37 AM UTC-6, Mike Driscoll wrote:

On Sunday, December 13, 2015 at 8:43:33 AM UTC-6, austin aigbe wrote:

Hello,

I am trying to port the Synfig UI (i.e synfig-studio) to wxPython.

For the AboutBox GUI, I noticed that GTK has some very cool features (e.g hyperlink in a text control, text control is able to glide upwards when you click a button to display it)

However, I have been able to create my own wx AboutDialog with all the features offered by the GTK equivalent. The only thing left are the animated license and credit text boxes and the hyperlink in the text box.

I don’t want to use the wx html Window. Is there a way of including a hyperlink in a TextCtrl?

Secondly, how can I animate the TextCtrl to glide up when it is displayed?

Thirdly, how can I animate the text to scroll up in the wx.TextCtrl?

Code attached with screen shot of what I am trying to achieve. You might have to download Synfig (http://www.synfig.org/cms/) to see the animated credits and license text boxes of the About Synfig Studio widget.

Thanks.

Regards,

Austin

The regular text control widget doesn’t really support hyperlinks, but the RichTextCtrl does. The TextCtrl does have a rich text mode, but I couldn’t find any information about whether it had support for hyperlinks. I don’t know how to get the animations you want. But one of the other guys on the list might.

Mike