How can I make number 1 in css? - colors

How can I make number 1 like this in css ??
The number in the circle enter image description here

See similar questions already answered in the threads linked below.
HTML + CSS: Numbered list with numbers inside of circles
UL List items with styled decimal numbers

Related

Combining pictures with python

Im currently working on a project where an object is placed on a 60cm x 60cm plate. This plate is divided into 4 sections where every section is 30cm x 30cm. Every section has its own camera that photoghraphs this 30cm x 30cm section (Actually its 31cm x 31cm so that the sections overlap a bit to eliminate the risk of missing some part):
I want to combine the pictures into 1 picture via python as if just 1 picture was taken from above.
So the result should like this (note that the picture of the whole tool is just a picture I took and not edited together from the 4 single pictures):
Input:
Top Left:
Top Right:
Bottom Left:
Bottom Right:
Expected output:
On the pictures I placed green cords to show the 30cm x 30cm segments.
Additional Info: The tool is placed on a LED panel to increase contrast. Also markers, for example black lines that divide the sections, could be placed if this opens new possibilities to code. This could look something like this:

How to draw a picture whose name corresponds to an int?

I have made a Pokedex in Python and I want to draw a picture of the right Pokémon. Drawing a picture is no problem, but drawing the correct one is harder. I have 800+ images of Pokemon that are named after their Pokedex number (For example, Bulbasaur is the first Pokemon in the Pokedex and thus has a number 1, and it's picture is named '1.gif').
How can I draw the picture that corresponds to the number that is searched for?
I know that coding 800+ if statements is way too complicated and that this can be done easier, I just don't know how.
This is the code I'm using to draw a picture. At this moment, it only draws the picture of Bulbasaur.
pic = Image(Point(350, 410), "1.gif")
pic.draw(win)
Any help would be appreciated!
Function were born to avoid using an infinite number of if statements!
def drawPokemon(pokedex_num):
pic = Image(Point(350, 410), str(pokedex_num) + ".gif")
pic.draw(win)

Is it possible to scale a text to a certain width by changing font attributes?

Let me add an image to describe my question.
http://i.stack.imgur.com/SisN7.jpg
My facebook name is located at the top-left. It has 9 characters and it is centered on the dark gray block.
Right now, if my name was just "D", it would appear on the place where "D" letter is located. Alternatively, if my nickname was something like "IHaveAVeryLongUsernameWoah", it would overflow to pink area.
Is there any auto-scaling feature on FabricJS, so I can simply define the max-width, and FabricJS calculates font size automatically?
Like, if there is a single letter, print it at the center. If there are alot of letters and letter width exceeds maximum size, then lower font size.
Not sure if this is doable. Any help would be appreciated.

Masonry: Fit Width but maintain maximum container size?

Per the example in the Masonry documentation, http://masonry.desandro.com/options.html, I centre my Masonry layout by setting isFitWidth = true, and setting {margin: 0 auto} on the Masonry container.
When I have loads of items to display this is a really nice solution. For example, let's say my viewport is just over 5 columns wide, I will see all the items laid out, 5 to a row, and the whole container centred within my viewport. Lovely.
The problem arises when I have less than 5 items. In this case, the container remains centred in the viewport, but it shrinks to fit the number of items. So if I have, for example, two items, I will have two columns in the middle of the screen, with one item each.
What I would like to see is the container maintain is size (in this example, 5 columns), and remain centred, and lay the content out LTR (in my case).
I have experimented with media queries and setting a minimum width for the container based on the viewport. This looks like it will work, but it's messy - I don't fancy having to update the media queries (including recalculating all the gross container widths) each time my column size changes. (I'm sure users will want some changes).
Another solution might be to add some fake items to the content and set their visibility to hidden, but this is not exactly elegant either.
Is there a more simple solution that I'm missing?
One additional point - I am stamping some items in place too, top left and top right. I don't think this should affect any solutions.
OK, So the only way I could find to do this effectively was to use media queries. I setup a spreadsheet to help recalculate things when I changed column and gutter sizes. Here's the variables and equations, in case they are helpful:
If:
WC = Width of column
WG = Width of gutter
N = Number of columns
CON = Width of container
Then:
CON = N*WC + (N-1)*WG
You can set up a spreadsheet and experiment with WC and WG, and a range of N=1...10 This will give you the size of CON for each value of N. The width of the viewport needs to be CON plus any horizontal margin and padding on CON (or its parent).
To set media queries I took the approach that the container should be as wide as possible, but still neatly accommodate exact columns. So, for example, if the viewport can accommodate 5 columns, (but not quite 6), I set the corresponding min-width on CON. This leave the container neatly centred.
By way of example, here is one of my media queries:
#media (min-width: 996px) and (max-width: 1361px) { .content-container { min-width: 966px; } }
I hope this is helpful to someone. I'll leave the question open for a few days in case there are other solutions forthcoming.

Box plot with labels and axes, fitted to a div with fixed dimensions

Following the provided example I built a function that draws a box plot to a jQuery accordion tab, which has a certain fixed height & width. The amount of distinct categories varies greatly depending on the incoming data. Currently I'd like to achieve the following in the plotting:
1) Add axes and display labels, like in this picture
2) Always fit the boxes to container width and height. Currently I see that if there are too many categories, some of them end on the second row, ensuring they're not fully seen. In the picture, the div contains 7 boxes but only 4 fit on one row:
The question is how can these two be implemented? I couldn't even figure out a way to reliably reduce the padding between the boxes without eating into the side numbers on the boxes.
I adopted the original d3.js example to include axes:
http://bl.ocks.org/jensgrubert/7789216
Instead of using individual svg elements as in Mike's implementation, here all boxplots are rendered with in one root element. This makes it easy to add axes.
Best,
Jens
For the time being I'm using a hack found at Highcharts forum (jsfiddle here). There's also a box plot implementation made with Raphael.js that looks cool (github, example)

Resources