Pycharm Cheat Sheet



Hello, Flask 2.0 is due for release soon, with a release candidate 2.0.0rc1 available now on PyPI. Please try this out and let us know if there are any issues. PyCharm Cheatsheet. Search/Replace find string in all files control+shift+F replace Ctrl+Shift+R. Pycharm Cheat Sheet by boris.indelman - Cheatography.com Created Date: 1904Z. PyCharm creates a new Python file and opens it for editing. PyCharm takes care of the routine so that you can focus on the important. Use the following coding capabilities to create error-free applications without wasting precious time. Code completion. Code completion is a great time-saver, regardless of the type of file you’re working with.

This is a quickstart reference to using PyAutoGUI. PyAutoGUI is cross-platform GUI automation module that works on Python 2 & 3. You can control the mouse and keyboard as well as perform basic image recognition to automate tasks on your computer.

All the keyword arguments in the examples on this page are optional.

PyAutoGUI works on Windows/Mac/Linux and on Python 2 & 3. Install from PyPI with pipinstallpyautogui.

General Functions¶

Fail-Safes¶

Set up a 2.5 second pause after each PyAutoGUI call:

When fail-safe mode is True, moving the mouse to the upper-left will raise a pyautogui.FailSafeException that can abort your program:

Mouse Functions¶

XY coordinates have 0, 0 origin at top left corner of the screen. X increases going right, Y increases going down.

Pycharm Cheat Sheet Pdf Mac

If duration is 0 or unspecified, movement is immediate. Note: dragging on Mac can’t be immediate.

Calling click() just clicks the mouse once with the left button at the mouse’s current location, but the keyword arguments can change that:

The button keyword argument can be 'left', 'middle', or 'right'.

Pycharm Cheat Sheet

All clicks can be done with click(), but these functions exist for readability. Keyword args are optional:

Positive scrolling will scroll up, negative scrolling will scroll down:

Individual button down and up events can be called separately:

Pycharm Cheat Sheet Windows

Keyboard Functions¶

Key presses go to wherever the keyboard cursor is at function-calling time.

A list of key names can be passed too:

The full list of key names is in pyautogui.KEYBOARD_KEYS.

Keyboard hotkeys like Ctrl-S or Ctrl-Shift-1 can be done by passing a list of key names to hotkey():

Individual button down and up events can be called separately:

Message Box Functions¶

If you need to pause the program until the user clicks OK on something, or want to display some information to the user, the message box functions have similar names that JavaScript has:

The prompt() function will return None if the user clicked Cancel.

Screenshot Functions¶

PyAutoGUI uses Pillow/PIL for its image-related data.

On Linux, you must run sudoapt-getinstallscrot to use the screenshot features.

If you have an image file of something you want to click on, you can find it on the screen with locateOnScreen().

The locateAllOnScreen() function will return a generator for all the locations it is found on the screen:

The locateCenterOnScreen() function just returns the XY coordinates of the middle of where the image is found on the screen:

These functions return None if the image couldn’t be found on the screen.

Note: The locate functions are slow and can take a full second or two.

Tips & Tricks

Learning something new is not only about getting new knowledge or mastering new skills – it is also about building new habits and getting the most joy out of something. That’s why with this blog post we wanted to start a series of posts covering learning methods and tips and tricks designed to help you to learn more effectively and make you more comfortable and excited with learning Python in PyCharm Edu. It may also help set up productivity habits that will be quite useful for further professional Python development with PyCharm. So, let’s start!

While coding, as well as learning how to code, it is very important to feel comfortable. The development environment should suit your needs and preferences and help you to stay focused and avoid distraction. You can use the default settings but the option is there for you to easily configure your environment in a way that makes sense to you if you want to.

Use keyboard shortcuts
Go to the dark side
Stay focused with a minimalistic UI
Find any action with ease

Use keyboard shortcuts

We encourage you to use keyboard shortcuts, as they can significantly speed up your coding and even reduce the risks of Repetitive Strain Injury. PyCharm Edu is a keyboard-centric IDE. You can choose one of the preconfigured shortcut schemes, or keymap, in Preferences | Keymap:

You can always take a closer look at the list of actions and corresponding shortcuts with the help of search:

Or, you can search an action by shortcut:

You can also set up your own keymap if you need a customizable list of shortcuts.

Pycharm Cheat Sheet

Please note, that we use default Mac OS scheme (Mac OS X 10.5+) in this blog post. If you use the default keymap of your OS and want to have a nice looking cheat sheet to print out, go to Help | Keymap Reference to get it.

Go to the dark side

PyCharm Edu initially uses the default light color scheme, but you can always switch to the dark Darcula scheme. Please go to Preferences | Appearance & Behavior | Appearance and choose Darcula as Theme under UI Options section:

Or you can use the Ctrl + Backquote(`) shortcut:

Stay focused with a minimalistic UI

When you open your course in PyCharm Edu, you can see the main tool windows that help you get around: Project View, Editor, Task Description:

But after a couple of lessons, you may want to minimize the UI and focus only on the tasks you’re going through.

Step 1: Manage tool windows

First of all, let’s hide the Project View window by clicking on the Project tool button, or with Cmd + 1 shortcut. That will give us more space for code and the task description:

We can also hide all tool buttons with the tiny screen icon at the bottom left of the window:

To open any tool window whenever it is needed, just use the same icon:

or, invoke View | Recent Files (Cmd + E) command:

Now we have a more clear UI:

Step 2: Set up the task description panel

Task description needs to be visible, to hide it completely is not advised. But still, we can make it a bit less distractive by moving it around.

If you work with two monitors, one of the best options is to switch the task description panel to a floating mode and move it to another monitor or just place it near the main IDE window. You can do so with the help of special tool window settings icon:

Or if you prefer you can move the panel to the left, or to the bottom:

So the IDE looks like this:

Pycharm Cheat Sheet

Step 3: Switch to editor any time you want

While learning you will write new code, run it, then go back to task description, etc. So even if you’ve started with a very minimalistic UI, at some point you will need to return to that kind of view:

If you want to easily go back to the editor and focus on your code, the Hide All Windows command (Shift + Cmd + F12) is the best option:

Just invoke it once again to show all the windows back.

Find any action with ease

I’ve started this post with an exhortation to use shortcuts. And I want to finish up with my favorite feature, to thank everyone who has reached this section 🙂

It is very hard to remember all the shortcuts and all the actions and productivity boosters PyCharm Edu has. But don’t worry about that. All you need to remember is just one action that rules them all, Help | Find Action command (Shift+Cmd+A). Just start typing the action you need, and get the list:

And even more, you can change your preferences just from this list. Find an option you want to change and press Enter:

Pycharm Cheat Sheet Pdf

There you go. Let us know how you like these features! Stay tuned to not miss the next portion of tips & tricks for more efficient learning. Share your feedback here in the comments or report your findings on YouTrack, to help us improve PyCharm Edu.

Pycharm Shortcuts Cheat Sheet Pdf Mac


Your PyCharm Edu Team