Most viewed recipes tagged "browser"http://code.activestate.com/recipes/tags/browser/views/2017-04-03T13:37:34-07:00ActiveState Code RecipesFile browser for tkinter using idle GUI library (Python) 2017-04-03T13:37:34-07:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580772-file-browser-for-tkinter-using-idle-gui-library/ <p style="color: grey"> Python recipe 580772 by <a href="/recipes/users/4189907/">Miguel Martínez López</a> (<a href="/recipes/tags/browser/">browser</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/idlelib/">idlelib</a>, <a href="/recipes/tags/tkinter/">tkinter</a>). </p> <p>Idle is installed by default on windows.</p> <p>For Ubuntu, Linux Mint and Debian run:</p> <pre class="prettyprint"><code> sudo apt-get install idle-python2.7 </code></pre> <p>A tree structure is drawn on a Tkinter Canvas object. A tree item is an object with an icon and a text. The item maybe be expandable and/or editable. A tree item has two kind of icons: A normal icon and an icon when the item is selected. To create the tree structure, it's necessary to create a link between tree items, using a parent-child relationship. </p> <p>The canvas is built using a <em>idlelib.TreeWidget.ScrolledCanvas</em> class. The <em>frame</em> attribute of this object contains a <em>Frame</em> Tkinter widget prepared for scrolling. This frame allocates a Tkinter <em>Canvas</em> and Tkinter <em>Scrollbars</em>. This is the signature:</p> <pre class="prettyprint"><code> ScrolledCanvas(master, **options_for_the_tkinter_canvas) </code></pre> <p>It accepts exactly the same arguments than a <em>Canvas</em> widget.</p> <p>A tree item should be a subclass of <em>idlelib.TreeWidget.TreeItem</em>.</p> <p>The parent-child relationship between tree items is established using the <em>idlelib.TreeWidget.TreeNode</em> class.</p> <p>This is the signature for <strong>TreeNode(canvas, parent, item)</strong>:</p> <ul> <li><em>canvas</em> should be a <em>ScrolledCanvas</em> instance. </li> <li><em>parent</em> should be the parent item. Leave that to <em>None</em> to create a root node.</li> <li><em>item</em> should be the child item</li> </ul> <p><em>FileTreeItem</em> is a type of <em>TreeItem</em>. The only argument of a file tree item is a path.</p> <p>Here there is an example of a custom tree item:</p> <p><a href="https://code.activestate.com/recipes/579077-bookmarks-browser-for-firefox/" rel="nofollow">https://code.activestate.com/recipes/579077-bookmarks-browser-for-firefox/</a></p> <p>To create your own tree items, it's required to subclass <em>TreeItem</em>. These are the methods that should be overrided:</p> <ul> <li><em>GetText:</em> It should return the text string to display.</li> <li><em>GetLabelText:</em> It should return label text string to display in front of text (Optional).</li> <li><em>IsExpandable:</em> It should return a boolean indicating whether the istem is expandable</li> <li><em>IsEditable:</em> It should return a boolean indicating whether the item's text may be edited.</li> <li><em>SetText:</em> Get the text to change if the item is is editable</li> <li><em>GetIconName:</em> Return name of icon to be displayed normally (Icons should be included in <em>ICONDIR</em> directory)</li> <li><em>GetSelectedIconName:</em> Return name of icon to be displayed when selected (Icons should be included in <em>ICONDIR</em> directory).</li> <li><em>GetSubList:</em> It should return a list of child items (Optional. If not defined, the element is not expandable)</li> <li><em>OnDoubleClick:</em> Called on a double-click on the item. (Optional)</li> </ul> <p>Icons should be included in "Icons" subdirectory of path to idlelib library. If you want to use other path, just change <em>ICONDIR</em> variable to path to your icons:</p> <pre class="prettyprint"><code> import idlelib idlelib.ICONDIR = "Your path to your icons" </code></pre> <p>Run this to find the path to <em>idlelib</em> module:</p> <pre class="prettyprint"><code> python -c "import idlelib; print(idlelib.__file__)" </code></pre> XML viewer for Tkinter or XML treeview (Python) 2017-02-22T23:00:21-08:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580752-xml-viewer-for-tkinter-or-xml-treeview/ <p style="color: grey"> Python recipe 580752 by <a href="/recipes/users/4189907/">Miguel Martínez López</a> (<a href="/recipes/tags/browser/">browser</a>, <a href="/recipes/tags/tkinter/">tkinter</a>, <a href="/recipes/tags/treeview/">treeview</a>, <a href="/recipes/tags/viewer/">viewer</a>, <a href="/recipes/tags/xml/">xml</a>). Revision 3. </p> <p>Tk widget to display XML for Python. I use the treeview widget. There is no external dependency.I also added support for autoscrollbars.</p> Using proxy connection for QWebView (Python) 2009-10-02T02:32:51-07:00Keisuke URAGOhttp://code.activestate.com/recipes/users/668964/http://code.activestate.com/recipes/576921-using-proxy-connection-for-qwebview/ <p style="color: grey"> Python recipe 576921 by <a href="/recipes/users/668964/">Keisuke URAGO</a> (<a href="/recipes/tags/browser/">browser</a>, <a href="/recipes/tags/gui/">gui</a>, <a href="/recipes/tags/pyqt/">pyqt</a>, <a href="/recipes/tags/qt4/">qt4</a>, <a href="/recipes/tags/web/">web</a>). Revision 4. </p> <p>QWebView is powerful web browser. This script can use a http-proxy host. Log file name is minibrowser.log in same directory.</p> Web based Query Browser (PHP) 2011-06-15T03:54:02-07:00Jonathan Fenechhttp://code.activestate.com/recipes/users/4169413/http://code.activestate.com/recipes/577753-web-based-query-browser/ <p style="color: grey"> PHP recipe 577753 by <a href="/recipes/users/4169413/">Jonathan Fenech</a> (<a href="/recipes/tags/based/">based</a>, <a href="/recipes/tags/browser/">browser</a>, <a href="/recipes/tags/php/">php</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/web/">web</a>). </p> <p>Query browser works </p> <p>add password to this part of the code if you require a password for mysql</p> <p>Code =</p> <p>// Connect to the database $conn = mysql_connect('localhost', 'root' 'PASSWORD GOES HERE");</p> Detect what browser your website is being accessed from using php (PHP) 2013-06-19T20:09:55-07:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578571-detect-what-browser-your-website-is-being-accessed/ <p style="color: grey"> PHP recipe 578571 by <a href="/recipes/users/4184772/">Captain DeadBones</a> (<a href="/recipes/tags/browser/">browser</a>, <a href="/recipes/tags/php/">php</a>, <a href="/recipes/tags/server/">server</a>). </p> <p>This is a short hack on how to figure out what OS you site is being accessed from. This is useful if you want to redirect to different versions of your site through php. </p>