Is there anyway to take a screenshot of the entire console window? - python

I'm working on some analysis, and I'm printing things to the console in order to analyze them.
This scrolls on for anywhere from 10-30 "moves". Is there any way to somehow screenshot the entire console? What I'm currently doing is splitting it into 5+ screenshots, then stacking them all vertically in a word document. I know I could write something to essentially turn it all into HTML, but that isn't what I'm looking for. Just hoping to be able to screenshot the entire console window. (I use PyCharm for development, although I'm not sure if there is a IDE specific solution, or just an overall one)
I would just copy-paste it, but I'm using color-codes ANSI sequences for the coloring, and its not wanting to paste properly.

Not sure how effective it will for you. But
Picpack
a third part software works fine for me:-
And there a few other options too which you can try... Because In you're case such Application will be a lot of helpful.
Other software which You can use for this part:-
Apowersoft Screen Capture Pro
Blockquote
Snagit

Related

How to control result size when using jupyter on vsc and how to search for words in result

I'm currently using Jupytor Notebook on VSC. I found it very uncomfortable when very long result come out because I have to scroll down a long way to go the the next cell, like shown in the picture.
So I was wondering if there is a way to make the result like the original Jupyter Notebook, where they have a separate scroll for the result as shown below.
As an additional question, anyone know how to search for certain words in the result on VSC? ctrl+f only searches for words in the coding cells and not the result.
A work around for the scroll wheel if you don’t want to collapse the code is to add a print statement to the beginning and end of the code block as mentioned in Collapse Output in VS Code Jupyter Into Scrollable Window. I have not been at my computer to test this and this post is from a year ago, so I’m not sure if this solution is still working. EDIT: This solution is no longer working keep an eye on the linked issue for the resolution.
This was also brought up as an issue on GitHub and it was closed saying they have no plans to work on it currently.
#118117
As for the searching in outputs, this is an open issue currently on GitHub: #94239
Scrollable output regions would be handled in VS Code core. This function has not been decided on GitHub at present
For your additional question, I think the filter feature in the search widget might be what you're looking for - you can include outputs with that.

Python 3.4 how to create a line of text that always stays at the top of the screen while the script runs

I'm trying to find a way to keep a fixed line of text displaying at the top of the screen the entire time a Python script runs. Functionally, it would behave like the top line in nano editor; the program title remains at the top of the screen, even when scrolling through text in the editor area. The idea is that the line would contain the name of the script that's running, and perhaps some dynamic information (progress indicators), and remain visible even when text output beneath that line scrolls.
From what I've researched so far, the curses module could possibly provide the foundation for reaching that goal. I have yet to find a curses example that specifically demonstrates what I'm trying to accomplish, and the learning curve is a bit steep for me at the moment.
The scripts would run on a Linux box without a GUI.
Thanks!
If you want something simpler than curses, then look into using npyscreen.
This framework should be powerful enough to create everything from quick, simple programs to complex, multi-screen applications. It is designed to make doing the simple tasks very quick and to take much of the pain out of writing larger applications.
And it's built on curses.

Formatting Python string output

I'm writing a calculator currently and I'd like to have results displayed in a visually appealing form. The program just has a command line interface for the moment, but I've been trying to find a way to do various things with the results it displays. For example, I'd like to have it display the result in a bigger font size, a different font than system default, and even subscripts and superscripts. From what I could find, the best way to do such things would be if I introduced a GUI and used something like wxPython, and using Unicode code points can only resolve part of the issue. Moreover, for various reasons, I'd just like to have the program in command line for the moment.
I don't think you can accomplish this with the command line, but you might check out curses. I would suggest picking up a GUI for this sort of thing. It's really not too hard to learn and Python's builtin Tkinter is perfectly functional for getting started. There are many good resources for Tkinter. Here are a few I like:
effbot.org
Thinking in Tkinter
An Introduction to Tkinter
WxPython is excellent, but if you are just getting started my suggestion would be to start with Tkinter. Others might disagree...
EDIT
I just remembered running across the console module for Windows. I suspect it won't won't get you what you want, but at least it's out there.
If you're running this on the command line, I'm almost certain that there's nothing you can do to override the font preferences set by the user. In both windows and Linux, the font settings of the command line are user controlled, and I doubt that you can change it without sudo access. Seeing as you're writing a calculator, I don't think a user would want to run it as sudo - I certainly wouldn't want to run something as simple as a calculator with sudo privileges. To require that would make the user think that you are up to something malicious

Windows Balloon-tooltips in Python

Following the example at http://article.gmane.org/gmane.comp.python.general/541418, I've succeeded in creating a callable class for balloon tooltips, but the greater complexities of that code elude me when it comes to customization. I browsed a bit of how it works through msdn, but being a novice at more windows-esque languagues like c and vb, etc. I was unable to make much sense of it.
So I ask ye snakely academics:
Things I'd like to be able to do with that code aside from the standard icon, title, text:
Perform actions based on clicking the tooltip
Modify the tooltip that pops up over the icon in the system tray after loading it (to reflect changing values)
Multiple lines? (Not sure if this can even be done, really)
More information on other things you could do in a windows 7 environment versus XP (which seems to be what this was written for).
Ideally I'd get some sort of return value or some semblance of an event when the tooltip is clicked so that I could run some code, but currently I'm importing that code as a module and calling at various times, so I'm not sure how to handle clicks outside of the popup code itself...
Information on handling these things with python seems quite scarce. Thanks in advance.
Perform actions based on clicking the tooltip
Whats the problem OnTaskbarNotify? Hock yourself in there.
Modify the tooltip that pops up over the icon in the system tray after loading it (to reflect changing values)
Probably not, I am not sure about the WinAPI here. I haven't seen it in the wild, so...
Multiple lines? (Not sure if this can even be done, really)
With most WinAPI, just insert a \n in the string.
More information on other things you could do in a windows 7 environment versus XP (which seems to be what this was written for).
LOTS... But that is a bit vague... It depends what your needs are. But for kol feturez you need to google on your own...
On Linux and Unix systems I use the notify-send OS already implemented system.
import os
os.system('notify-send "'+title+'" "'+message+'")
Maybe in Windows there is some API32 for this.
Check this https://gist.github.com/wontoncc/1808234

How to make PowerBuilder UI testing application?

I'm not familiar with PowerBuilder but I have a task to create Automatic UI Test Application for PB. We've decided to do it in Python with pywinauto and iaccesible libraries. The problem is that some UI elements like newly added lists record can not be accesed from it (even inspect32 can't get it).
Any ideas how to reach this elements and make them testable?
I'm experimenting with code for a tool for automating PowerBuilder-based GUIs as well. From what I can see, your best bet would be to use the PowerBuilder Native Interface (PBNI), and call PowerScript code from within your NVO.
If you like, feel free to send me an email (see my profile for my email address), I'd be interested in exchanging ideas about how to do this.
I didn't use PowerBuilder for a while but I guess that the problem that you are trying to solve is similar to the one I am trying to address for people making projects with SCADA systems like Wonderware Intouch.
The problem with such an application is that there is no API to get or set the value of a control. So a pywinauto approach can't work.
I've made a small tool to simulate the user events and to get the results from a screencapture. I am usig PIL and pytesser ORM for the analysis of the screen captures. It is not the easiest way but it works OK.
The tool is open-source and free of charge and can be downloaded from my website (Sorry in french). You just need an account but it's free as well. Just ask.
If you can read french, here is one article about testing Intouch-based applications
Sorry for the self promotion, but I was facing a similar problem with no solution so I've written my own. Anyway, that's free and open-source...
I've seen in AutomatedQa support that they a recipe recommending using msaa and setting some properties on the controls. I do not know if it works.
If you are testing DataWindows (the class is pbdwxxx, e.g. pbdw110) you will have to use a combination of clicking at specific coordinates and sending Tab keys to get to the control you want. Of course you can also send up and down arrow keys to move among rows. The easiest thing to do is to start with a normal control like an SLE and tab into the DataWindow. The problem is that the DataWindow is essentially just an image. There is no control for a given field until you move the focus there by clicking or tabbing. I've also found that the DataWindow's iAccessible interface is a bit strange. If you ask the DataWindow for the object with focus, you don't get the right answer. If you enumerate through all of the children you can find the one that has focus. If you can modify the source I also advise that you set AccessibleName for your DataWindow controls, otherwise you probably won't be able to identify the controls except by position (by DataWindow controls I mean the ones inside the DataWindow, not the DataWindow itself). If it's an MDI application, you may also find it useful to locate the MicroHelp window (class fnhelpxxx, e.g. fnhelp110, find from the main application window) to help determine your current context.
Edited to add:
Sikuli looks very promising for testing PowerBuilder. It works by recognizing objects on the screen from a saved fragment of screenshot. That is, you take a screenshot of the part of the screen you want it to find.

Categories