How do I force an object to overlap in PySide? - python

I'm trying to create a search feature in my pyside program that shows results based on a user input. Currently, I have a QLineEdit setup for the user to make an entry. When the user enters a match, the results should appear in the QLineEdit as it will expand. The program is divided into two frames: A top frame (where the search bar is located) and a content frame which shows the raw content.
My issue is that when I am trying to expand the QLineEdit, it doesn't allow itself to overlap into the content frame and becomes hidden. Here's an image of what I would like to happen.
Before:
After:
I understand that I have horizontal policies setup on both frames with a "No-frame" frame shape, would this have an impact on the output?

Related

QTableView - how to highlight only text with color (not entire cell)

I would like to for some of the columns in my QTableView give color highlight to the text without filling the rest of the cell with color. This image shows exactly what I want:
What is the best way to do this? One option is to create each text value as an image externally and then set it as an icon (I know how to do that from other SO posts). But is there a better way?
I will do this for quite many tables / columns with many different values so I would need to create many images if I use icons. So it would be great if there is a way to instead write the text in the QTableView and somehow apply the color background so that it covers the text only.
Is it possible to e.g. paint that background using an item delegate somehow? Has someone done something similar with item delegates before and that can share an example of how it's done? I'm very new to Qt.
I'm using PyQt6.

How to get background image in tkinter to show above all labels except text on it

I have created a weather GUI application which is working well
Here is the code:
https://github.com/ApurvaLawate/Weather/blob/master/weatherApp.py
I want to add one last functionality. The app recieves data in JSON format which has one variable called data['weather']['main'] which can have 8 values like Rain,Thunderstorm,Drizzle, etc. I want to change background of this App to Drizzle.jpg if the data['weather']['main'] == Drizzle which can be done but before that the image must be showing on entire background and not just behind labels. Here is the output for reference:
https://drive.google.com/file/d/13SZQK9i1uXd7Qq4p-3KMTMZnhSFJJtXM/view?usp=sharing
I have also noticed that changing width of labels changes their position and the image shows up on more area. So the problem is more like making labels transparent except for the text. Please share any help.

How to show 2 scene side by side in asciimatics

I'm try to use asciimatics for a TUI, which will be the front end for a test frame work. The TUI should have some parameters that are constant and are common for all tests, and another section where there are parameters based on the selected test.
I'm pretty sure I can get this to work if I create a main frame for the common parameters, and frames for each individual test, then, based on the selected test open the specific test frame when the user clicks a button to edit test parameters.
However, I would much rather have the test parameters shown along side the common ones. I was thinking about putting the second frame inside a layout, and swapping it on the fly when the selected test is changed. Is this possible to do with asciimatics?
Thanks,
o
As documented in https://asciimatics.readthedocs.io/en/stable/widgets.html#layouts-in-more-detail, a Layout belongs inside a Frame. You can't put a Frame in side a Layout.
However, there is no reason you can't just use two Frames next to each other. Simply create them with the right size and locations to be side by side.

QLineEdit: disable a part of text with or without mask

I would like to insert a mask in a qLineEdit widget, where at the left side the user can insert any text he wants (limited to the maximum limit of qLineEdit) and at the right there whould be a disabled text (mask).
Unfortunatelly I am not abled to upload a picture with the wanted result.
An example could be that the qLineEdit will accept lenght values in meters. The qLineEdit should have an disabled 'm' at the very right of the widget and at the left part the lenght can be inserted manually by the user.
f.e. [1234.567 m], where m is disabled
I am working with Python 2.7 and pyqt4.
Thanks in advance.
This should be easy enough using QLineEdit::setInputMask(), provided you don't have any special requirements regarding the behaviour of the input while using the mask; I found it hard to customize when it was set. Example:
input.setInputMask("0009.000 m")
As an alternative you can set a QDoubleValidator for the edit widget and add the units as separate label to the window layout right beside it.

Tkinter - Scrollable list with images and editable text

Using Tkinter I want to create a scrollable list(rows and columns) with images and editable text. The first column should contain images and the second column should contain tags(text) for the respective images in the previous column.
Hence a row should contain an image in a column and text in the next column.
Please let me know, what widget i need to use in Tkinter in order to achieve this.
Thanks for any help.
I would use a single frame for the images and editable text. You can use a text widget for the editable text, and align them using grid.
Then, place the frame in a canvas so that it can be scrolled. There are many questions and answers on this site related to scrolling a frame. See, for example, this answer: https://stackoverflow.com/a/16198198/7432

Categories

Resources