Is there a widget for wxPython like the SuggestBox in Google Web Toolkit? It is basically a magic text box that can invoke some code to come up with suggestions relevant to whatever the user has entered so far. Like the search box on Google's web page.
If such a widget isn't already floating out there, I'd appreciate a sketch of how I might implement it with the existing widgets.
You might want to look at Combo Box that Suggests Options.
I hope this is what you were thinking of.
Few years ago I made a control like this by subclassing TextCtrl. It supports HTML formating for suggestions. Here you go.
Related
I've made a GUI for my application but I've to make it look professional. Currently, I think it's looking casual. Also, I want to print some outputs to the textbrowser widget. How should I do that?
I've tried making some changes to stylesheets of widgets, but the options available are not adequate.
My GUI looks like this
The QTextBrowser class provides a rich text browser with hypertext navigation. It opens a URL to display, not plain text.
Use something like a QPlainTextEdit, or a QTextEdit for doing this.
They have methods like appendText, or appendPlainText.
Alternatively, you could have a website and host your text there, but that seems overly complicated.
I wender if there is standard or custom control on wxpython to display text and other media to gather ,i mean something similar to web browser.
i tried webview but it is not support html5 elements of media.
The simple answer is "No". wxPython does not have such a control. I do think webview will get you the closest to what you want. For video, you will have to use wx.Media:
http://www.wxpython.org/docs/api/wx.media.MediaCtrl-class.html
If you really need to have an all-in-one control, then you'll have to create your own custom widget or look at a different UI toolkit to see if they have the widget you need.
I'm using Qwebview with Pyside/Qt to view an HTML page on a GUI I'm working on.
I need the possibility to add a search text function, otherwise it is useless for the purpose the GUI is made.
I've searched but I didn't find anything useful for build a code that search the text and scrolls down the page as it is made in the common browsers.
The only function I found is findText but it returns a boolean and I cannot see how it can be useful.
Do somebody have an hint / advice / guide or code for this request?
Thank you.
Okay, so it turns out that i had an example of this using a QTextBrowser, which has a lot of this built into utility functions.
You can still do it with a QWebBrowser though.
Bind ctrl-f to open a search panel, and then make it so that the search box sends out two signals;
(presuming it's a QLineEdit), returnPressed, and textChanged.
Each of them then calls findText on the QWebPage object.
The important part is setting the correct flag in the findText call (which you'll want to set with checkboxes in your search functionality, i'd say).
You set the flags so that HighlightAllOccurrences is not set.
I cannot see any way to get details on a selection. Are you sure that when you do not set the HighlightAllOccurences flag it does not scroll to the next selection automatically?
I have been able to create normal popup menus (such as context ones) using self.PopupMenu(menu, pos) and constructing a menu however one issue I run in to is that whenever I pop it up (say when I change the text in a text box ala search such as in Google Suggestions or iTunes) it will change the focus to the context menu. This seems to be built into the PopupMenu system, is there a way to show a menu but not give it focus.
Examples
Similar to (but not exactly) SuperTooltip in wxPython Demo
What these are (but in wxPython) https://developer.apple.com/library/mac/documentation/userexperience/conceptual/applehiguidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-SW4
Right now it looks like I just should create it out of a dialog with no title etc.
iTunes
Google Search
It sounds like you want an autocomplete window. There's an article on this topic on the wxPython wiki here:
http://wiki.wxpython.org/TextCtrlAutoComplete
You might also find this article helpful:
http://megamicrobase.wordpress.com/2009/01/16/adventures-in-wxpython-autocompleting/
Or perhaps this thread:
https://groups.google.com/forum/#!topic/wxpython-users/tgQcNj0b1kY
I'd like to make a small desktop editor to take notes, that uses markdowns to format text quickly. The application should transcribe markdowns instantaneously or after clicking on a button.
For this I'd like to use Qt4 and Python.
What, in your opinion, is the most efficient way to proceed?
In the case the rich text is rendered after pressing a button, I suppose I could use QTextEdit widget for the edit-mode, but what to use to display the rich text? I want this to look good. Should I render the text in HTML? Or something else?
Please advise.
You can look at how ReText has done it. Maybe even ReText is the app you want to code :-)
I came here because I'm looking for a solution for the same task.
Here is what I would (or hopefully will) try:
Subclass QTextEdit, which can display both plain and rich text.
supply two string properties, one containing Markdown source, the other generated HTML.
For entering "edit mode" (however your UI will handle this)
self.setText(self.markdown)
self.setReadOnly(False)
For leaving "edit mode":
self.markdown = self.toPlainText()
self.toHtml() # convert self.markdown to self.html
# don't know yet how to achieve that
self.setHtml(self.html)
self.setReadOnly(True)
For displaying the HTML one can use a CSS stylesheet.
As UI interface I could imagine: clicking on the readonly display mode switches to edit mode, [Ctrl]-[Enter] triggers HTML generation.