PyQt, Toggle between different View-Layouts? - python

so I am using PyQt and the Qt Designer to create a little tool that is loading up data from a file.
I would like to have three buttons above a table (does not have to be a QTableWidget if there is a better solution), the table is displaying things like a small image, name, and other related stuff.
I would like to toggle between the design of the table, like button 1 displays only a list, button 2 the same list but with images in column0 and button3 should show huge images instead of tiny list entries, is there a Widget to use or how should I try to accomplish this?
Thanks

Related

How to display a dataset in a table format in tkinter gui app

I would like to display the contents of a 2D list in a table format on a tkinter gui I am making. From what I understand tkinter doesn't have a built in method for creating tables, is there a way I can mimic a table, or maybe display an externally generated HTML table? (Just to spitball an idea)

Using the Tkinter radio-button widget for a GUI in my python application

I'm developing a python application that models forex derivatives. The intent of the project is to create a GUI that can:
create data models
display visualizations of that data
update the visuals while they're open
quit all windows with one button
This all functions as intended.
Currently, the GUI uses 6 Tkinter 'entry' widgets and 5 Tkinter 'button' widgets.
'Update' buttons use (their respective) entry fields to generate 'result-sets', which are then saved to .txt files.
'Display' buttons read data in the .txt files, and create visuals using Matplotlib's Animation function.
What I want to do: replace the 'size' entry field with: radio-button / checkbox / slider Tkinter widgets.
For example: Consider a user who wants to model the purchase of 10 forex contracts. Instead of typing 10 into the 'size' field (and clicking update), they mark the 10 radio-button and click 'update'.
What I've attempted and failed to do: I've read a number of Tkinter radio-button / checkbox widget tutorials which have been a waste of time. Honestly, I'm struggling to conceptualize how I can add this functionality.
If applicable, the GUI is formatted by a class.
The best approach imo would be a slider.
slider = tk.Scale(master, from_=0, to=10, orient=HORIZONTAL)
and then later make a function to get that chosen value from slider like:
size = slider.get()
Have a good day.

Is it possible to create elements using Bokeh widget DIV that respond to bokeh server commands?

I've been using Bokeh's datatable, but there are a few things I'd like to do that I don't know how to accomplish using the DataTable class. For example, I don't think it's possible add icons (or any images) to different rows, or setting the table to single selection only. So, I've been thinking about implementing just a HTML table, and writing it with the DIV widget.
However, I'd still like to add interactive features to the table, like buttons, or the icons mentioned above. Then, when an event is generated (e.g. onClick), that event is captured by the Bokeh server, and I can write the handlers in Python to do things such as modifying the data in ColumnDataSource, for example.
Is this possible? Or is there a better way to accomplish this?
Thanks!
I think the approprate way to achieve what you want is to create a custom widget:
Extending Bokeh Documentation
Custom Widget Example
I do not paste here the complete example because it is too long.

PyQt QTreeWidgetItem Individual windows with individual data.

I have a QTreeWidget that contains rows of data for multiple students. When double clicking on a row, a window opens, with a number of drop down menus and text edits that a user can input into. Currently, the user can open the file menu in the top left corner of that window and save the file manually in a folder from there and also open it, but this is inefficient for my program, and I want to make it so that each individual student in the QTreeWidget will have their own individual window open up, that, when a save button is pressed in the window, the data within the window will save within a database of some sort, and when that student's window is opened again, the information inputted specifically in the window and saved earlier for that student will load up automatically.
The QTreeWidget looks something like this (ignore the issue with the scroll bar in the corner. Names have been censored for data protection):
QTreeWidget
And the window containing user inputted data looks like so:
Popup Window
If there are any documentations or tutorials that could help me with this issue, I'd love to know, because I can't seem to find anything related to this anywhere. Even any basic ideas on how I could go about introducing this function into my program would be of great help. I am using Python 3.4 and MySql.
Why don't you start with studying how the standard MVC is implemented in Qt?
The following resources should be a good start for you:
this intro site
or this video series

Is there a tkinter widget to easily display a table (SQLite) in a window (canvas)?

I have a database table (created using the SQLite3 library) and would like to be able to open a new window (in a program that I am writing) which will simply display the contents of the table (*.db) with a scroll bar to the user (perhaps on a grid like you would find in a spreadsheet).
Are there any easy ways of achieving this?
I think you would use
.grid() in a Frame or
multiple Listboxes with as many scrollbars as you like.

Categories

Resources