Using pygame and font.render, how do I make sure the text doesn't go across a certain boundary but instead move down? - python-3.x

tutorialText = tutorialFont.render("""A sliding puzzle is a type of game where a player must
rearrange a set of pieces to complete an image by sliding the pieces into the empty space.
This game is a variation of a sliding puzzle, where you can click near the blank spot or use the
arrow keys to move blocks around. To solve the game, you must rearrange the letters to form words.
There are numbers at the bottom to guide you. To have solved a game, starting from the topmost
left block, the number will be 1, and reading from left to right the numbers will go in order go
all the way to the last column before going to the next row.
The blank block will be the bottom most right block.""", True, (255,255,255), (196, 164, 132)).
I have a lot of text, I don't want it to go over 200 pixels away from the starting position, which is (0,100), so no over (200,100), but instead go down.
I have tried searching online, but I haven't found anything yet.

Related

Make a split in the middle of a worksheet

I am wanting to add a split vertically at Column I, basically splitting the worksheet into 2 halves. I want to be able to scroll up and down on the left half while the right half doesn't move and then move over to the right half and scroll up and down while the left half doesn't move.
I have tried "Split" but it doesn't work how I would like.
Select View > New Window.
Then do Win+LeftArrow on window1, and Win+RightArrow on window2.
Tada..
Hope it solves. ( :

Can't get flexbox container to expand horizontally to match content

The flex layout below is working except the content container (blue) is sized by the columnar items before they wrap.
I want the blue container to expand to the right to fit the content (ie the horizontal measure after the items wrap)
Any hints would be appreciated.
Some more research shows that this is a well-known, long standing, bug, but only for the column orientation, not for the row orientation.
So the solution is to switch to "upside down" day. Turn the column into a row with the css writing-mode:'vertical-lr', then specify flex-direction:'row to match, and it works!
... but all direct children need to have their writing mode reset: writing-mode:horizontal-tb

Looking for suggestions on data filtering options in Excel via VBA

I have a project where I want to filter down a lot of data based on user's selections of 8 different criteria. In my case it's kitchen cabinets but a more universal example would be cars. The user is presented with a userform containing 8 listboxes, one for Make, Model, Package, Color, Transmission and so on. Double-clicking on a listbox item removes all other choices in that listbox and filters out invalid choices from all the other listboxes. The choices compound so the user could choose "Green" for Color and "Ford" for Make.
I've done this two different ways already and I'm not happy with either.
1) I created a matrix where I listed Models down the left hand side and each of the other 7 features across the top with "X" at the intersect points. Then I taught VBA how to basically read it like a human would using a ton of nested loops. This was pretty slow, where each selection caused the program to halt for 1-2 minutes while it sorted everything out.
2) I listed out every single possible combination (some 22,000) and used Excel's built in filtering options to filter the data, then copy each column of the results onto a second sheet, filtering out duplicates and re-sorting them, and using that to re-populate the listboxes. This worked really well but for some reason I can't fathom, Excel gets hung up for 3-10 minutes doing something when I filter certain columns. I debug/traced it and the hang up happens after all my code is run, but before it returns control to the user.
At this point I'm open to any suggestions. Ultimately I need the user to choose one complete (all 8 options narrowed down to one choice) configuration. The tricky part is the user may start with color "Green" which would eliminate all other colors from the "Color" choices list, as well as any Make, or Model, or Package, etc that doesn't come in Green from their respective lists. Maybe data would help explain it?
Make Model Package Color Transmission
Ford Focus LT Blue Manual
Ford Focus LT Green Manual
...
Ford Focus ST Blue Manual
...
Ford Focus LT Blue Automatic
...
And so on for 22,000 rows.
So if the user chooses "Manual" I need to drop the "Automatic" rows. If the user then chooses "ST" I need to drop the "LT" rows (while assuming the Automatic rows are still being filtered out, and so on until there's only one row left.
Just an idea that came to mind: Are you familiar with a highly efficient method of searching for words in a dictionary of words called Trie?
If you code each option properly you could enter the whole option map in a Trie. When a user makes a selection you follow that path in the Trie. If no matching option exist then the Trie returns Null and you can inform the user about that.
Good explanation of a practical Trie implementation for words:
https://www.geeksforgeeks.org/trie-insert-and-search/

How to increase set of data by increment of 1 in excel?

I have a set of data in excel, which varies in size, that I need to increment the final number by 1 each time I duplicate it. For example:
100065202-TR01
100065204-TR01
100018998-TR01
100065202-TR01
100065204-TR01
100018998-TR01
100065202-TR01
100065204-TR01
IB500-TR01
100005693-TR01
100065202-TR02
100065204-TR02
100018998-TR02
100065202-TR02
100065204-TR02
100018998-TR02
100065202-TR02
100065204-TR02
IB500-TR02
100005693-TR02
I need a way that I can increment TR01,TR02,TR03... up to TR20. The text before the -TR** will remain the same every time, I will simply be duplicating a (sometimes very large) block of data but want to change the final number each time.
If you select the data you need and then "pull" to the right by clicking on the bottom right corner, where the black square is, it is done automatically by Excel.
See result

Hidden column after export to excel when table has less than 4 columns (SSRS)

I faced following problem with exporting ssrs report to excel.
When I create a table having 4 columns and then exporting it to excel I get the proper layout:
But when I remove at least one of the column in ssrs designer (when table consists of less than 4 columns), after exporting it to excel, one column is being hidden:
When I manually changed the width (by typing width in properties window) to at least 3 cm, after exporting it to excel the additional column disapeared (even if the table has less than 4 columns).
Does anyone know why this happens?
Any help will be appreciated.
Easy solution: Work in POINTS, not Inches or Centimeters.
Excel renders in points, so this prevents all roundoff in positioning. It is that easy.
It's an issue with the header.
To avoid this all together insert a row in your tablix (above everything else) and set the "RepeatOnNewPage" tablix property to 'True' (Advanced Mode >> select the static row groups you need to repeat >> RepeatOnNewPage).
This approach does the same thing as a header and you won't have to deal with those pesky extra columns any longer!
Try rectangle in to rectangle.
If this do not work - insert a list and insert your object in to list.
This should help - don't know why is that - but sometimes it take a lot of attempts and scenarios to work this out for one report... just keep trying with rectangles and lists - this is what I always do.
This is common problem in SSRS - the way how I removing this problem is to use rectangle's .
Insert rectangle then CUT your table/matrix PASTE inside rectangle - make sure there is not empty spaces.
If you using more than one table/matrix , then insert rectangle inside rectangle etc. ( my record is 14-th depth ) - this is VERY annoying but I know only this way.
- ALSO - fit everything to left side corner
It works fine for me ... what ver of excel do you use ?
Can you post here rdl file or code from file ?
Are you using report builder or Visual Studio ?
- Do you have any more objects on the report or just that table ?
D.
I find that if you have headings in your reports above the actual tablix, you will have to extend the width of the heading to match the width of the tablix (you should see the blue lines showing the alignments) and ensure that the headings also align with where the tablix begins. Basically, just make sure that everything is aligned. Hope this helps.
After struggling with this for a few days this blog post helped me out:
How to eliminate merged and hidden Cells issue from Excel Export of SSRS report - MSDN
The problem seems to be that pixels and centimetres (or inches) don't line up nicely. When you drag the columns around they get non-exact approximations of the value. When you put a nice round number (even like 3.25cm) they seem to play nicer. You'd probably want to use pixels or points (what Excel uses to store cell size) to prevent the last column compressing.
I hope this helped a bit...
Late to the game, as usual. But I played around with this for a while, and it looks to me like it's just going to end up being fairly random. Sometimes I can get them to go away, sometimes I can't. I don't always have the ability to change things to nice round numbers that represent an even number of points. And even when I do, it still doesn't always work. But I did notice this. If you zoom in closely, you can see that the lines are just slightly misaligned. Believe me when I tell you that mathematically that shouldn't be happening. But I wondered if that might help explain the problem.

Resources