Swipe-Layout using PyGTK - python

I would like to implement a swipe or flipper view (widget) using PyGtk for my Quickly app. There should be a titlebar that contains the title of the currently showed content and the titles of the previous and next entry. To navigate threw the different entries you should be able to click the titles or swipe from left to right or vice versa.
But I do not know where to start.
Which Widget should I extend?
Would the Notebook widget the right choice?
How could I change the style of a Widget?
How do I implement the flip effect?
Do I have to combine different views (widgets) for the content pane and the titlebar?
For a better understanding of my problem view the screenshot below.
Thanks and best regards
Andreas

You might want to take a look at Clutter. Though I think, this kind of UI-Design could be very unintuitive on a desktop machine.

Related

How to remove borders on Tkinter buttons & frames?

I am currently building a simple app to encrypt files using AES encryption in python but the biggest downside of using Tkinter is the look of the UI. I did some research and found examples of what I want but do not know how to recreate it. (Example)
My problem is that when I replace buttons with images (like the OP of the Reddit post said he did in order to have a decent looking UI) I end up with an ugly bar of grey. (Image of the button)
I also want to remove the same type of bar with frames so if you have the answer for specifically that it would still be appreciated.
Support for for styles and themes has existed in tkinter for some time. A theme being a collection of styles for different widgets.
You can read more about style and themes here.
To the best of my knowledge, the standard widgets to not support rounded corners. All widgets have rectangular shapes.
You might be able to create something like that using a Canvas, but it would be a significant amount of work.
A more relevant point is that it might confuse your users if you don't reproduce the way the standard controls work.
UI elements are standardized for the same reason the controls in a car are; once you know one of them you can use all of them.

Kivy Look and Feel

I am trying to build a Kivy application with a sharp, crisp look and feel but the default Kivy UI is not exactly what I had in mind? Is there any way to create a custom theme to give your Kivy app style?
This app here is called Pithon and it was made from Kivy. I have searched everywhere but I can not find anything on how the developer managed such a clean look. Does anyone have any ideas?
A kivy developer called Andrés Rodríguez released a set of widgets based on google's material design principles. I am currently using them myself and they have surely saved me from alot of work. You can find KivyMD here (see bottom of this answer for more info). Their are some themes also based on the same principles but am yet to try them out one is FlatKivy and another is kivy material ui by Federico Curzel.
Some screenshots for kivyMD,flatkivy and kivy material ui respectively are here.
Click the highlighted links you will find a lot more info about the three projects.
The original KivyMD project by Andrés Rodríguez is no longer maintained but there is active fork of KivyMD by HeaTTheatR.
(Almost) all widgets have properties that can be used to set aspects of their style. For instance, with a Button you can change the background colour, the background image when pressed or released, and the size of the border region (it's scaled like in CSS border images). You can check the documentation for the specifics of a given widget.
An theme like in the screenshot you posted could be achieved by turning off background images for the buttons and just using solid colours, with the non-button text being normal Labels and the circle being drawn directly with a kivy canvas instruction or via an Image widget (along with an image of the circle).
I notice you mentioned padding in a comment but I'm not sure what you mean by it - do you mean the distance between the buttons? They may well be placed in a GridLayout which has a padding property controlling this, so you could set it to whatever you like.
I recognise that you're asking a more general question than 'how does this screenshot do it?', but the key point is that just about everything is customisable and it doesn't take many changes to go from the default theme to your image.
Edit: One useful feature that helps this kind of customisation is that you can use kv language to override styles for widget classes very easily, so you don't need to manually change every button etc.

Place a button inside a grid

In a gui I have a grid. In this grid each row represents an order. To the right of each row, I would like to place a 'cancel button'to cancel the order. When new rows are added this should automatically come with a cancel button.
I did some seaching but apart from this FAQ-question which states that you have to design something yourself (did not help me much). Al other material was based on usage of Tkinter which I do not want to do.
So Two questions:
(1) Does anyone know of a way to place a button in a grid cell in wxpython?
(2) If not, does anyone know of a solution for my requirement?
Thanks,
Django
There isn't really a "built-in" way to do this. You would need to create a custom Renderer. According to Robin Dunn (creator of wxPython) in this thread, you could create a button using wx.RendererNative.DrawPushButton.
I would also recommend taking a look at the wxPython demo as it has some other examples of custom renderers too.

Place a Button in ListCtrl - wxPython

Is is possible to place a button inside of a ListCtrl item with wxPython? Right now I have a ListCtrl that has data with a file name and size, and I want the user to be able to click a button, to download the file. If this isn't possible, is there a way to display an image in the ListCtrl, and then make it clickable so that I can bind an action to it?
No. You will have to use "UltimateListControl", a generic list implementation that can attach any kind of widget to rows. Check its demo files for examples.
You're probably best off grabbing the trunk code for bugfixes and other changes - I'm not sure how often Andrea updates the main zip on his site
I've yet to use the control, but its demo is very impressive.

How can I achieve layout similar to Google Image search in QT (PyQT)?

I'm new to QT. I'm using PyQT for GUI development in my project. I want to achieve this layout in my application. This application searches images from an image database. Google image search layout is ideal for my purpose.
I'm following the book "Rapid GUI Programming with Python and Qt" and I'm familiar with layouts. I guess I need to use a grid layout with each result image in each box of grid. & use vertical layout for (image,Qlabel,Qlabel) inside each grid box.
These are some problems I'm facing.
Importantly, I'm unable to display image. What control/widget do I need? I cannot find anything similar to PictureBox of .NET
How do I seperate these image result by fixed gap like in the image? I'm using Horizontal & vertical spacers but that isn't working?
How to set QLabel a clickable (like hyperlink). I don't want to a open a URL. Just the text should be clickable. So, that when user clicks on the link. I can show more information (like next set of results when he clicks on next page number or a new window with image in fullsize when user clicks on 'view') Do we have some new kind of control for this?
This is another important issue. I'll display the page numbers of results (like shown in figure) & assuming they are clickable. How do I load a new page of results? I mean what is the equivalent of page in QT?
As you can guess. This definitely wont be the first page of GUI. The first page will be exactly like http://google.com (a big logo & text box with button below it). when user clicks the search button. This page will be displayed. Again the same question comes up. How change the pages?
Please give a list of controls I'm going to need for this. Tell me if I'm unaware of something.
1/2.
For displaying the images and labels use a QListWidget with view mode set to QListView::IconMode. However, if you need to customize the display beyond what the QListWidget/QListWidgetItem api can provide you will need to create your own QAbstractListModel and use a standard QListView with it.
Make sure and read Qt's primer on model/view.
As for spacing the images, checkout the spacing property on the list view.
Here is an example from KDE's Dolphin file manager:
3. Use a regular QLabel, but set the contents to be an href.
Example:
edit: Oops I see from your tags you are using PyQt, the following is C++, but should be similar to what you would do in python.
QLabel *linkLabel = new QLabel;
linkLabel->setTextFormat( Qt::RichText )
linkLabel->setText( " Click me! " );
connect( linkLabel, SIGNAL( linkActivated ( const QString & link ) ), .... )
4.
Well, since you are using a Model/View, why bother having page numbers at all? The user will just be able to scroll the view and more pictures will be shown. This is by far the easiest solution as you don't have to do anything once you've got your M/V setup!
However, if you really want to show page numbers it will require more work in your model. For example, have a track the "current page" in the model and only allow access to images on the "current page". Then in your slot connected to the linkActivated() signal tell the model to change pages. I won't go into much more detail as this seriously violates the whole idea behind model/view. The "right way" of doing this would be to subclass QListView and add pagination support, but like I said why not use scroll bars? There isn't any performance hits to doing so.
5. Use a QStackedWidget, addWidget() all your "pages" to it, then call setCurrentIndex/Widget() as needed to switch the pages.
Thoughts:
It seems you are very committed to cloning the look, feel, and behavior of Google Image search, which is fine, but Google Image Search is a web application that uses interaction paradigms that are very different than a normal desktop application (links, pages, etc). You are presumably developing a desktop application, and by trying to emulate the behavior of a web app you will find it difficult as the API just isn't designed to support those sorts of interactions. By all means, it is doable, but you'll have your work cut out for you.
If you are extremely intent on sticking to the web based interaction style, why not code your app in javascript and HTML and toss it in a QWebView?
Try using QListWidget with viewMode set to IconMode. It should do all for you. BUT if you need to customize your data display use QListView with your own/standard model and own delegate for painting

Categories