How to make the direction of the carousel vertical in ipywidgets? - jupyter

from ipywidgets import Layout, Button, VBox, Label
item_layout = Layout(height='100px', min_width='40px')
items = [Button(layout=item_layout, description=str(i), button_style='warning') for i in range(40)]
box_layout = Layout(overflow='scroll hidden',
border='3px solid black',
width='500px',
height='',
flex_flow='row',
display='flex')
carousel = Box(children=items, layout=box_layout)
VBox([Label('Scroll horizontally:'), carousel])
enter image description here
expected result:
enter image description here
I tried to change flex_flow from row to column
Here is the result:
enter image description here

Related

How to add text under the heading in inline mode

enter image description here
I need to add text as shown in the picture above, but I don't understand how to implement it
my code:
def inline(inline_query):
markup = [
types.InlineQueryResultArticle(
number, language.warning,
types.InputTextMessageContent(language.warning_info)
)
]
bot.answer_inline_query(inline_query.id, markup)

Why a white box is visible, even though I change the position of the modal body?

I have used react bootstrap to display a popup when page is loaded. I want to change the position of the box with tailwind css and the position is changing but there's a white box present on the screen. can you please help me how to remove it?
import React,{useState} from 'react';
import {Modal} from 'react-bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
const Popup = () => {
const [show, setShow] = useState(true);
const handleClose = () => setShow(false);
return (
<>
<Modal show={show} onHide={handleClose}>
<Modal.Body className="bg-black absolute top-44"><input className="pl-2 py-1" placeholder="search..."/></Modal.Body>
</Modal>
</>
);
}
export default Popup
It will show because you are applying absolute position with top:44px you can use margin then it will show inside of white box if you don't required white box then you have to remove default background color from .modal-content class.

Unity Editor GUI, change the label width of EditorGUILayout.Toggle

I can't find a way to increase the label width of EditorGUILayout.Toggle. Here's my code, it doesn't do anything and Unity clips the text and cuts it short.
GUILayoutOption[] options = new GUILayoutOption[] {
GUILayout.Width(400.0f),
GUILayout.MinWidth(250.0f),
GUILayout.ExpandWidth(true)
};
MyBoolValue = EditorGUILayout.Toggle("My Long Description Text Here", MyBoolValue, options);
I did try wrapping the Toggle button with
EditorGUILayout.BeginHorizontal();
EditorGUILayout.EndHorizontal();
But it also didn't do anything. What can I do remove clipping from the text?
Set EditorGUIUtility.labelWidth before doing your Toggle, and then restore it to its original value so you don't mess up any subsequent controls.
float originalValue = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 400;
MyBoolValue = EditorGUILayout.Toggle("My Long Description Text Here", MyBoolValue);
EditorGUIUtility.labelWidth = originalValue;

How can I reset an image property to blank/null when changing another select in a dialog?

I need to remove the image and hide its label in the dialog when a value is selected from another dropdown. I also want to remove the image from the component itself.
Currently, I am able to hide the image in the dialog, but the image is not removed and is passed to the JSP file. I am using html5smartimage as xtype.
This is the dialog.xml code:
<imagepath jcr:primaryType="cq:Widget"
ddGroups="[media]"
fieldDescription="Best display supported image for large (400 x 270px)
and for small(260 x 193px)."
fieldLabel="Thumbnail Image"
fileReferenceParameter="./thumbnail"
height="200"
id="thumbnail"
name="./bkgimage"
rootPath=""
width="150"
xtype="html5smartimage"/>
Here's the JavaScript function:
function(comp) {
var panel = comp.findParentByType("panel");
var thumbnail = panel.getComponent("thumbnail");
var dropdown = panel.findById("height");
var width = panel.findById("width");
var thumbnailAltText = panel.findById("thumbnailAltText");
if (dropdown.getValue() == 'half-height') {
thumbnail.hide();
thumbnailAltText.hide();
thumbnail.setValue(' ');
} else {
thumbnail.show();
thumbnailAltText.show();
}
}

Change padding on fancybox depending on image width

I am new to javascript and jQuery and am trying to make a slideshow using Fancybox.
The problem is that I want the images to display on a box of the same size regardless of whether they are portrait or landscape images. My images are all either 700 X 525 for landscape or 525 X 700 for portrait.
The way I have it the landscape images load like it is showed on the top of the image below, the portrait images load as shown in the middle, and I want the portrait images to load as shown on the bottom, with the box with the same dimensions as if it were landscape:
I think what I should do is change the left padding depending on the image dimensions but I have no idea how.
Thank you for your help in advance.
I am using Fancybox version: 2.1.4 and I have set the defaults as such:
padding : 15,
margin : 20,
width : 800,
height : 600,
minWidth : 100,
minHeight : 100,
maxWidth : 9999,
maxHeight : 9999,
autoSize : true,
autoHeight : false,
autoWidth : false,
autoResize : true,
autoCenter : !isTouch,
fitToView : true,
aspectRatio : false,
topRatio : 0.5,
leftRatio : 0.5,
I know this post is 11 months old, but I thought I would share my solution in case it helps someone else out in the future.
Basically I have set a min-width css attribute onto the fancybox element and am comparing that against the current image width, if it is smaller I am adding padding to the fancybox element so that the fancybox element stays the same width but the image inside is horizontally centered.
Step 1: in your css set a min-width on the fancybox element. This is the width that you want your fancybox element to stay at regardless of image width.
.fancybox-wrap { min-width: 1120px; }
Step 2: add in the afterLoad function when you call fancybox
$(".fancybox").fancybox({
afterLoad: function(current) {
var $el = $(".fancybox-wrap").eq(0); // grab the main fancybox element
var getcurrwidth = current.width; // grab the currrent width of the element
var getdesiredwidth = $el.css('min-width'); // grab our min-width that we set from the css
var currwidth = Number(getcurrwidth);
var desiredwidth = Number(getdesiredwidth.replace('px', ''));
if (currwidth < desiredwidth)
{
var custompadding = (desiredwidth - currwidth) * 0.5; // if the width of the element is smaller than our desired width then set padding amount
this.skin.css({'padding-left': custompadding+'px', 'padding-right': custompadding+'px' }); // add equal padding to the fancybox skin element
}
}
});