PyCharm Tutorial | Introduction to PyCharm | Basics in 10 Minutes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody in this video we are going to be looking at the basics of how to use pychon i have used pycharm in some of my recent videos and some of you guys had questions regarding how to use pycharm so i thought that it would be nice to make a video on this topic i am going to assume that you already have pycharm installed but if you do not then don't worry about it there's going to be a link in the description down below to a video that i've recently made which talks about how to install pycharm and python so if you want to install it first then make sure to watch the video first and then come back to this one if you've already used pycharm a few times then the screen that i have open right now should seem familiar to you however if you've not yet used pycharm then the screen that you will see will look more like this you're going to have a project welcome screen and in my case there's a couple of projects listed because i've been using pycharm for quite a while now but for you this is going to be an empty list so the first thing that we're going to look at now is how to create a new project to create a new project we simply click on new project and then a new screen jumps up on this screen we first need to specify the location of where we're going to save our project we're going to add a sub folder to this location and we're going to call it pycharm toot tut which is simply short for tutorial the next thing that we need to specify is the virtual environment virtual environments are really useful and i always recommend that you use them because they allow us to manage settings and dependencies of a particular project regardless of other python projects that you have the location of the virtual environment is usually set by default and it is okay in this case we're simply going to leave it the way it is the base interpreter field on the other hand is one which you may need to adjust this field should contain the path which points towards the python executable file and it is going to be responsible for interpreting all the code that we write in our project at the very bottom of the screen you have the option to create a main.pi welcome script but we're just going to leave this field unchecked because we're just going to create our own file so the next thing you can do is simply press create and it goes ahead and makes a new project once it's finished loading you can see that on the left hand side of our screen we have our file tree if we look at the pycharm tute folder you can see that all it contains at the moment is our virtual environment if we want to create a new file we can go and right click then press on new and file then we're going to name the file that we want to create we're simply going to call it main dot pi and we've created a new python file the files that you create don't necessarily need to be python files if for example you want to add some documentation to your program you can also add a text document for example to do that you can simply right click on the folder then new file just as we did before and then add a text document for example read underscore me dot txt and over here you can then add some text that you want to include it is also worth pointing out that you can open the files that you've created in the explorer window for example if you right click on main and then go to open in explorer and it opens up the explorer with the file main which we've created before so if you want to manage your files in the file explorer you can also do that really simply now let us take a closer look at the editor on the right hand side of the screen one thing which you may want to do is to rearrange the windows and how they are displayed on the screen so if you want to display windows next to one another you can actually drag and drop the individual files next to each other or something which is also useful you can drag them on top of one another if you want to arrange them this way let's go ahead and close the readme.txt file for the moment and have a look at the main.pi file right over here we're going to go ahead and write our first small program which is simply going to be a print of the word hello so we're going to write print and in parentheses we're going to write hello now one way to run this program is to go ahead and open the terminal on the bottom of the screen over here and you can go ahead and write python and then the name of the file which is main dot pi and you'll notice that if i hit enter then it will display hello in the terminal which is exactly what we wanted our program to do however this method of running programs is a bit inconvenient and there is a better way to do this if you have a look on the top right hand side of the screen you can see that there is an option to add configuration and right next to that there is a play button which says run but at the moment it is still grayed out in order to be able to use this button to run the program we need to add a configuration now there are two ways to do this there's one short way and one longer way the longer way is actually to go ahead and click on this field then on the plus sign then on python and then fill out all these specifications but there is a quicker way to do this to have all of this automatically filled out which is you simply need to press ctrl shift and f10 if you do that it automatically adds a configuration and then you'll be able to save this configuration by saving main configuration in the drop down menu over here in order to see that the specifications have all been filled out automatically by simply using the shortcut we can simply go to edit configurations and you can see that each field that we had before has been filled out automatically by python so using the shortcut is really the way to go it is much faster and saves a lot of time the next thing i want to do is show you a couple of shortcuts that we can use in the editor that are going to become really useful to you if you start using pycharm on a regular basis so the first shortcut i want to show you is how to duplicate lines using control d so let's go ahead and select the first line and press ctrl duplicate which is ctrl d and you can see that we can duplicate a line indefinitely another really helpful shortcut is control and q and this allows us to fetch the documentation so if you have long programs and need to refer to the documentation you have it right here in a small window the next thing that you're going to be using all the time is finding and replacing individual words in your code if we want to find the word hello in our code all we need to do is press ctrl f a small window pops up and then we can go ahead and write the word that we want to search for let's simply search for the word hello and you can see that if i write hello it finds exactly four instances of the word hello in our code if you now want to replace the word hello with the word by all you need to do is press ctrl and r and then in the bottom window you need to write what you want to replace it with which is buy and press on replace all and now you've replaced all the hellos with a buy now you need to know that there are tons of different keybinds that you can use and tons of different shortcuts i'm not going to go through all of them but the ones that i just mentioned are pretty much the most useful ones in addition to that i do want to mention that you can actually remap the keybinds of all your shortcuts all you have to do is go to file settings and then key map and over here in the drop down menus you can go ahead and remap all the individual mapping of the shortcuts so if you have enough different preference to what is set by default you can go ahead and change that now let me move on to a really cool feature that i like in pycharm which is to-do's to-do's become really helpful in large projects because they actually allow us to list all the things that we still need to do in our project so if we want to see the to-do's that we have we simply need to press on this button down here and you'll see that at the moment it has found zero to do items in zero files so to add our very first to do all we have to do is we need to add a hashtag then to do and we can write whatever we want to do over here so a random to do and you'll see that now it has found one to do item in one file and you'll see over here there is a to do listed of course we can add multiple of these if you have a random to do and we add another one a random to-do and we'll give this a number one and two you'll see that it will list the individual to-do's in our file which is really beautiful especially in large projects all right so i'm going to leave it there for this video i hope that you now have a firm grasp of the basics of how to use pycharm if you would like to see me do a video on how to use the debug function then let me know by giving this video a like and yeah as always see you in the next video
Info
Channel: Code Bucket
Views: 6,009
Rating: undefined out of 5
Keywords:
Id: HHcZbXsZtm0
Channel Id: undefined
Length: 10min 0sec (600 seconds)
Published: Wed Sep 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.