How to add text under the heading in inline mode - py-telegram-bot-api

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)

Related

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

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

Aligning buttons in column in Red

I am brand new to Red/Rebol. I love it so far, I am experimenting with the GUI system.
I am trying to align some buttons in a vertical column so to speak.
This is what I have so far
Red [ Title: "Editor" needs: 'view]
view [ size 800x600 title "Save Notes"
t: text ""
a: area 500x500 black
button "Click" [t/text: "Red is good !" ] return
text "" button "Close" [quit] return
text "" button "Save" [save %notes.dat a/text t/text "Saved"]
]
This is what it creates, which I have annotated with what I am trying to do:
Welcome to Red!
In the VID dialect, the default direction where the next element will be put, is by default horizontal (across), so that a return will go to the next column. If you switch the direction to vertical (using below), then the next element will go in the next row, staying in the same column. So it gives you:
Red [ Title: "Editor" needs: 'view]
view [ size 800x600 title "Save Notes"
t: text ""
a: area 500x500 black
below pad 10x0
button "Click" [t/text: "Red is good !" ]
text "hello" button "Close" [quit]
text "world" button "Save" [save %notes.dat a/text t/text "Saved"]
]
Note: I just put some text into your empty labels, so that we can see them in the layout, and how they affect the positionning of the buttons.
Have fun playing with it! ;-)

How to detect a slide change in Slidy?

I use rmarkdown to produce a Slidy slide show using slidy_presentation. I would like to execute some Javascript when a slide is shown. In ioslides_presentation there's a slideenter event triggered when a page is shown (see Event when slide is displayed in ioslides?), but I don't see anything like that in Slidy.
I can detect whether a particular slide is being shown (by looking at the class of its div), but I don't know how to trigger the code to do that.
Is there some way to detect that a slide change is happening?
I researched a little and found an easy hack on how to detect which slide is currently shown:
Using a MutationObserver
In the following script we use a MutationObserver (see here and here) to observe changes in the content of the title element. Having the title we can extract the integer part of it, which represents a slide number.
In this example we just show an alert containing the text "Current Slide: " followed by the number we extracted.
Here ist the JavaScript snippet:
<script>
var target = document.querySelector('head > title');
var observer = new window.WebKitMutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
var title = mutation.target.textContent;
var current = +title.toString().match(/\d+/g);
alert('Current Slide: ' + current);
});
});
observer.observe(target, { subtree: true, characterData: true, childList: true });
</script>
Since we don't want the snippet to be interpreted as the content of a slide itself, we include it via the YAML header. Check the reproducible example below, where header.html contains only the the javascript snippet above:
MRE:
---
title: "Untitled"
author: "Martin Schmelzer"
date: "18 3 2017"
output:
slidy_presentation:
includes:
in_header: header.html
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## R Markdown
Slide 2 (Title slide is #1!)
## Slide with Bullets
This is slide 3!
## Slide with R Output
...and number 4!
EDIT: Modified script for ioslides
If somehow needed in ioslides, you can modify the JavaScript snippet the following way:
<script>
$(document).ready(function() {
var target = document.querySelector('slides');
var observer = new window.WebKitMutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if(mutation.target.getAttribute('class').indexOf('current') != -1 ) {
alert(mutation.target.getAttribute('data-slide-num'));
}
});
});
observer.observe(target, { subtree: true, attributes: true});
});
</script>
In slidy each slide consists of its own div container. The approach in ioslides is different. Here we only have a couple of <slide> elements for the past, current, next and far-next slides. The current slide element is the one which has the class current. So we just search for that class inside the forEach loop and grab it's data-slide-num attribute.

How can I wrap long text labels in highchart nested groups

i want to display text in wrap format in high chart nested group
If d.name is too long I'd like it to fill several lines instead of one.
[http://jsfiddle.net/vijay6512/5j9LLyxk/embedded/result/]
You can set useHTML flag as true and then set word-break:break-all in the css.
CSS
.highcharts-xaxis-labels {
word-break: break-all;
}
HC
labels:{
maxStaggerLines: 1,
useHTML:true,
},
Example: http://jsfiddle.net/5j9LLyxk/3/

SWTBotEclipseEditor title and tooltip text

how to find the title and tooltip text of SWTBotEclipseEditor.getText() method gives the text inside SWTBotEclipseEditor.
SWTBotEclipseEditor editor = bot.editorByTitle("testFoo.txt").toTextEditor();
String title = editor.??? //I want title which is testFoo.txt
String toolTip = editor.getToolTipText(); //not giving 'tooltip text'
please help
As a workaround,I used editor.getReference().getTitle() or
editor.getReference().getTitleToolTip().
http://www.eclipse.org/forums/index.php/t/373784/