What is the equivalent to the browser's "Box Model" Layout Inspector in the browser debugger, but for kivy?
I come from a background of web development, where "UI" debugging is done in a browser. Probably because of widespread rendering issues (w3c standards ambiguity or implementation errors in web browsers), the tools for debugging "why did my HTML render like that!?!" are quite sophisticated in web browsers.
I can simply press F12 in Firefox (also now Chromium) to open a debugging window, click on the top-left-most button (the element picker), then as I drag my mouse across the page, every distinct element (as well as a tree of breadcrumbs to the given child element) is highlighted.
If I click on a given UI element, then the html element cooresponding to the UI element is highlighted, all CSS elements are also shown, as well as a "Box Model" in the Layout tab that shows me clearly the width, height, margin, padding, and border of the element. This "Box Model" is so extremely helpful to figure out, tweak, and fix UI rendering issues when designing web pages.
Enter UI development with kivy, it takes me days instead of minutes to figure out what's going on because I don't know of a similar tool.
I want a way to be able to wrap a given kivy app with some debugger such that, as I hover over widgets in my kivy app, the full tree (breadcrums) of that tree is shown in real-time as I move my mouse across the screen. And if I click somewhere in the app, it dumps for me all of the properties of that widget, such as width, height, spacing, padding, etc (actually just enumerating the entire __dict__ of the given widget object). And, ideally, a visual representation of that widget and its sizing is displayed, like the "Box Model" screenshot above.
What's the best equivalent in kivy development for the web browser's debugger and "Box Model"?
Related
How can I change the size of the main interface (where most of the dashboard is)?
I made a dashboard using Streamlit. This dashboard has a sidebar and the main interface. I realized I need to hide the sidebar if I want to see the entire dashboard. Of course I can scroll right if I want to see the entire main interface, but this is exactly what I want to avoid.
How can I do this?
I am using python code such as below to click an element within an iframe on an angularjs page.
browser = webdriver.Ie()
browser.switch_to.frame('name')
browser.find_element_by_id('value').click()
After using click() I am unable to manually highlight text that appears on the page. Why might this happen? How can I restore the ability to highlight text with the mouse?
I have tried switching back to default content, but this makes no difference. Any ideas?
Other strange effects after using click(): Links and buttons don't work while using the mouse manually unless double-clicked. These would normally require single click. It is as if there is an invisible overlay blocking text selection or clicking links. Radio buttons and menus still work.
Edit: The site uses silverlight and I am wondering if this is related to the problem that results from using click().
I've got a text view and a web view, each inside a scrolled window of their own and I'm trying to achieve synchronized scrolling between the two but I can't seem to get it to work.
The web view is basically taking the text from the text view and rendering it as marked up HTML via webview.load_html_string(). I think the problem could be the delay in loading the HTML as every time the web view is refreshed it is scrolled back to the very start.
Right now I call a function every time the content of the text view is changed and then modify the vadjustment.value of the scrolled window containing the web view.
But this doesn't work. Is it because of the delay? I can't think of any way to solve this issue.
why do you want sync those scrollbars? You can achieve this by using the same Gtk.Adjustment (number of pages sets to 0).
I haven't use much of webkit but it essentialy a widget. so maybe a workaround would be disconnect a signal "value-changed" from Gtk.Adjustment until "load-status" signal from WebKitView reached Webkit.LoadStatus.FINISHED (if that's the correct syntax).
If that doesn't work, maybe you use WebKitView.move_cursor () (if i remember the function properly) based on Gtk.Adjustment on your text view (we use 2 adjustments this time)
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'm currently developing a small application in Python with the use of GTK+ (and Glade). Everything has been fairly simple to integrate so far, until I came up with the idea to add tabs instead of pop-ups. Note: Still using Python 2.7+
Is there any easy way to implement already existing pages inside a new tab(notebook) like structure? I'm having difficulties to find how to add content per separate tab created in glade.
Perhabs a more 'clear' question: What Notebook function will be required to call a specific V/HBox with every different tab? The current structure looks like (minus Menu / statusbar):
[ mainWindow ] --> (1) mainOverview (gtkVbox) --> (2A) mainContent (gtkHbox) ... other non-related content
The structure I was hoping for would look like:
[ mainWindow ] --> (1) mainOverview --> (2) noteBook --> (3) Tab1 --> (4) mainContent (gtkHbox) -- (3) Tab2 --> (4) secondaryContent (gtkHbox)
The application itself works fine (multithreaded, fully functioning) without the tabs, the mainContent(gtkHbox) contains a file/recursive directory analyzer, a few checkboxes and a general overview. I was hoping for an easy way to display this main window (the gtkHbox) ONLY when having Tab1 selected.
Having difficulties to find good reference pages that display a proper way to call content pages per notebook tab. Any reference-pages or useful links are very much appreciated! Thanks so far! My apologies if this is a rather newbish question, I'm not new to Python coding, but interfaces on the other hand... ;)
Not an answer, but it looks like "another.anon.coward" already answered this in a comment...
If you double click on the tab, then that page is selected for adding content in glade. You can go ahead and add content for that page. As for switching you can use set_current_page to switch to page whose content you want to display. Register for "switch-page" signal to find out which page has been switched to.
click on the notebook widget on the widget explorer(object inspector) on the left of glade. Then use your left and right keyboard arrow keys to move from tab to tab. You can also double click on the label of the tab as pyrotherm has said in his answer. But if you want to do it programatically get the notebook object from the ui using the get_object method of Gtk.builder class. Then do this to add a page
builder = Gtk.Builder()
builder.add_from_file("example.glade")
self.notebook = builder.get_object("notebook1") # set the id of the notebook in glade
self.page1 = Gtk.Box()
self.page1.add(Gtk.Label(label="Default Page!"))
self.notebook.append_page(self.page1, Gtk.Label(label="Plain Title"))
Now add the content you want to it. Now on to signals. Pyrotherm has already answered it. though there is no signal named switch-page. its named switch_page. You can look at the list of signals of notebook here