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.
Related
I am trying to make a GUI that is very similar to Spotify using PyQT
I've already designed the main window and I am struggling with applying the design to QT Creator.
This is what I want it to look like
But I'm trying to use Layouts in order to organize every widget.
For example
Image of the main window, split into 3 parts
like in the sketch I've made the software will be split into 3 parts, left bar, mid which is where the explore title is and right bar.
The problem I have is that I can't control the layouts size and the size of what's below them for example in the sketch the mid bar is wider than the right bar and the right bar is wider than the left bar but in the QTCreator I've no idea how to change the width and height of objects inside Layouts.
The first option (which I personally prefer) is to fill your layout with it's contents first (buttons, labels, etc.). This will already start to scale your layout, if there are more buttons in the middle bar than on the other bars. If your layout still isn't what you want it to be, you can use Spacers. They can push and pull puttons and position the in relation to other parts of the layout, as well as to the layout itself. The scaling will be adjusted automatically according to the spacers position.
This option has the advantage, that your application will be correctly scaled and not completely chaotic when it is run on a device with a display aspect ratio which is not the same as the one of the machine your developing it on.
There is, however, also a minimumSize and maximumSize attribute to the layouts, which provide a much more straightforward possibility, but sometimes cause your layouts to become very weird when adding or removing a button, or changing the text of a label. More on this option can be found in the Qt docs:
https://doc.qt.io/qt-5/qlayout.html
I'm creating a program with Python that finds the best routes for workers. It display a map with their itinerary and time of itinerary. I have 3 layers, one for each transport car, metro and bike. When i tick or unticked them it display or erase them from the map. I would like to have the same features but with the duration of the run. Like if there was layers inside each one of the first 3 layers.
layerVoiture = folium.FeatureGroup(name=description, overlay=False, control=True)
Some code describing the layer :
layerVoiture.add_to(myMap)
mapTile = folium.TileLayer(tiles='OpenStreetMap') #StamenToner
mapTile.add_to(layerVoiture)
it displays this i would like to make the left part, where the duration of runs are displayed, tickable or untickable
Thanks for your help
you can use FeatureGroupSubGroup to create groups within your FeatureGroup.
For example:
from folium import plugins
group_0_15 = plugins.FeatureGroupSubGroup(layerVoiture, name="De 0 à 15 minutes", show=False, overlay=False)
I am working on something similar and still have one issue: I can't combine radio buttons (set with overlay=False) and check boxes (set with overlay=True) in the legend (LayerControl). They are in two seperate areas in the legend. Here is an example.
So if you only want to use radio buttons or check boxes, it should work. In my case, I am using only check boxes even though it is not exactly what I was looking for. Here is what I achieved, by creating 3 sub-groups in each group.
I hope it still helped!
I am messing around in PsychoPy now, trying to modify the Sternberg demo for a class project. I want the stimulus text—the number set—to display in a variety of colors: say, one digit is red, the next blue, the next brown, etc. A variety within the same stimulus.
I can only find how to change the color of the entire set. I was wondering if I could add another variable to the spreadsheet accompanying the experiment and have the values in the cells be comma separated (red,blue,brown…). Is this possible?
No, that isn't possible right now. There's an experimental new stimulus class called TextBox that will allow it, but you'd have to write code to use that (not available yet from the Builder interface). Or just create some tif images of your stimuli and use those?
The current way to implement this is to have a separate text stimulus for each digit, each with the desired colour.
If the text representation of the number is contained in a variable called, say, stimulusText then in the Text field for the first text component put "$stimulusText[0]" so that it contains just the first digit. In the next text component , use "$stimulusText[1]", and so on.
The colour of each text component can be either fixed or vary according to separate column variables specified in a conditions file.
SO.
I've been busy working on a project in python and pygtk. I want to have (at the top) a "Toolbar" with back, forward etc. buttons and a long Entry that would take the rest of the horizontal space. I don't get the desired effect, however, as the space the Entry takes is quite limited.
self.omnicont = gtk.ToolItem()
self.omni = gtk.Entry()
self.omnicont.add(self.omni)
I've tried set_child_packing (which doesn't apply to Toolbars, it seems). I couldn't find any other way.
The buttons I have are declared in this way:
self.bBack = gtk.ToolButton(gtk.STOCK_GO_BACK)
and similar, so I don't think it's possible to put buttons like this in an HBOx.
How can I have the Entry take all the available horizontal space and, if that's not possible, how could I get an HBox to contain buttons with the stock icons?
Accordingly to the docs you can use:
set_expand(True)
on the item you want to expand.
Can anyone help or point me in the right direction for figuring out how to create a drag and draw rectangular box to be used as a selection tool in PyGtk? I am presently using an event box with a drawable window and the user can click once in the upper left and once in the lower right corner of the portion of image they would like to choose which will then draw a rectangle over the selection, but a drag and draw rectangle will allow the user to better adjust and get better accuracy.
I have looked quite a few places for information or a tutorial on this but I haven't found much. I am relatively new to Gtk+ so perhaps this is so simple that no one has to ask.
Actually, this doesn't seem all that lamebrained at all. It is actually quite specific, and a little challenging.
I'll give you the steps to start you off, but as you're beginning (and you didn't post any specific code), it would be better for you to create the code yourself based on documentation and my hints.
By the way, look up the official PyGTK documentation - that should be your definitive source for all the objects and functions of PyGTK. It is very well written and exhaustive, and I rarely have to look more than five minutes to find what I need.
What I suggest you do is use three signals, connected to your drawing area.
button-press-event
button-release-event
motion-notify-event
Create three callbacks (tutorial here), one for each event. Connect your drawing area to your events and callbacks (again, see tutorial. You may need to go through a few pages on it.).
You are going to also need to create two boolean variables on the global level (above the main class, at the same level you import modules.) The first controls whether the selection tool is chosen (call it "Select_On"), and the second for if it is active (call it "Select_Active")
On the button you use to start the select tool, set "Select_On" to "True". This should probably be a toggle button, so make sure you set it up so "Select_On" gets set to off if you toggle the button off.
On button-press-event, create the object for selecting. What you're going with now actually should work well. Also, set "Select_Active" to "True".
On motion-notify-event, change the size of your object based on cursor position. Refer to that documentation for that particular kind of object to learn how to change its size, and refer here for how to get the cursor position.
Be prepared to write an algorithm to determine how to change the size of the selection object based on the cursor position. If you need help with that, feel free to ask for it in a separate question.
On button-release-event, set "Select_Active" to "False", and call all your code for actually confirming the selection.
As an aside, the benefit to using the "motion-notify-event" is that, as soon as the cursor leaves the widget you're selection in, the selection box stops changes sizes. The cursor must re-enter the widget to continue changing the selection box size.
I hope all that works for you, and wishing you the very best on your project!