PyGtk3, How to prevent horizontal expand in VBox? - pygtk

i can prevent vertical expand in VBox with pack_start(button, expand = False, fill = False, padding = 0) command but widgets in VBox always expanding horizontally. i want make widget in center on horizontal plane. is there a method for make widget in center on horizontal plane ?

set_halign() method can do this
button = Gtk.Button()
button.set_halign(Gtk.Align.CENTER) # to center the widget
or
button = Gtk.Button(halign = Gtk.Align.CENTER)

Related

Jetpack Compose OutlinedTextField with the label on the inside and golden glow around the outline when selected

I'm trying to make a TextField like in the image using Jetpack Compose.
So far no luck in finding a easy way.
The label must stay inside the outline, if I use OutlinedTextField there is no way to customise that. If I use the TextField which has the label on the inside there is no outline when selected, just the line below the textfield.
Also I need to add a shadow/glow effect with a custom color, here seen in gold.
I'm stumped..
Any thoughts?
You can do this by creating a Row with a Modifier.drawBehind that uses native paint to draw blur with color as in this image, the one with pink background has blur with same background color for shadow for instance, you can check the code for drawing colored blur here.
val myColor = color
.copy(alpha = shadow.alpha)
.toArgb()
val transparent = color
.copy(alpha = 0f)
.toArgb()
frameworkPaint.color = transparent
frameworkPaint.setShadowLayer(
radius,
dx,
dy,
myColor
)
it.drawRoundRect(
//...
paint = paint
)
It draws a shape behind you can draw a shape with stroke.
For the label and input create a Column with Modifier.weight() to use space inside row other than space reserved for Icon with close image.
Instead of TextField you can use a BasicTextfield which doesn't have default padding, however you can achieve the same thing with TextField too, but you will need to set colors to transparent to remove indicator line, it has some default padding you might not want to have.
TextField(
colors = TextFieldDefaults.textFieldColors(
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
disabledIndicatorColor = Color.Transparent
)
)

How to fix horizontal scrollbar fixed in extjs grid?

My grid has a lot of vertical data which increases height of the grid.
And to move horizontally i.e to move the horizontal scroll bar I need to first move the vertical scroll bar low below and the move the horizontal bar and then again the vertical bar to see the top records.
Is there a way that the horizontal bar is always visible i.e its fixed.So that I dont need to go further down.
if the only thing in your page is grid, you cantry adding your grid to a viewport.
var _viewport = new Ext.Viewport({
layout: 'fit',
items: grid,
renderTo: Ext.getBody()
});
Regards.

How to resize ext.net container with border layout on browser window resize

Below is the markup i am using to render an EXT.NET container containing a collapsible panel(west) and another panel containing my content (center).
how do i make it resizable when i resize my browser?
currently its not resizing as i specified width and height and if i do not specify Width and Height, it does not show me anything, it shows blank.
#Html.X().Container().Layout(LayoutType.Border).Width(500).Height(300).Items(
Html.X().Panel()
.ID("Panel1")
.Region(Region.West)
.AutoDoLayout(true)
.Collapsible(true).Border(true).Title("West Panel").Items(
Html.X().Label().Text("Item 1"),
Html.X().Label().Text("Item 2")
),
Html.X().Panel().ID("Panel2").Region(Region.Center).Title("Center")
)
EDIT : I Cannot use ViewPort as its distracting my layout
I am not ure container support this but viewport.
Use instead of the container an viewport
#Html.X().Viewport().Layout(LayoutType.Border).Items(
Html.X().Panel()
.ID("Panel1")
.Region(Region.West)
.AutoDoLayout(true)
.Collapsible(true).Border(true).Title("West Panel").Items(
Html.X().Label().Text("Item 1"),
Html.X().Label().Text("Item 2")
),
Html.X().Panel().ID("Panel2").Region(Region.Center).Title("Center")
)
another solution I can imagine ,to get the resize event and set the width and height of container with the appropriate values

How to rotate an object from its center when using Object3d.lookAt()

I'm drawing texts and computing their bounding boxes. I always want the texts to show their face to the camera and so I'm using following lines:
textArr.forEach(function(text) {
var textGeo = d.geometry;
text.lookAt(camera.position)
})
It's working fine but it rotates from top left corner and I can't change the axis of rotation:
How can I make it rotate from center of the text while using .lookAt()?
Try center the pivot using
THREE.GeometryUtils.center(textGeo)

programatically duplicate xaml control in WP

I'm not getting how I could duplicate a XAML element pgrogramatically. For example if I define on XAML a rectangle om the middle of the screen, the user presses a button and I would like to duplicate this rectangle with all properties of it and then put it to the right of the first one, should this be possible?
Sure - just do a deep copy of the properties you want inserted and then add it to the panel. Assuming your controls are in a StackPanel with horizontal orientation:
Rectangle newRect = new Rectangle()
{
Width = oldRect.Width,
Height = oldrect.Height,
Stroke = oldRect.Stroke,
// repeat for other values you want the same
};
myStackPanel.Children.Add(newRect);