Building a GUI with PTVS

Dec 2, 2011 at 5:58 PM

Hello all,

I have everything up and running. I have two queries:

1) Under VS2011 Tools/options/Python Tools/Interpeter options, everything matches the image on the "Installation details" on this website, except for the "Generate Completion Database" is open to be selected and the "Remove Interpreter" button is greyed out (i.e. the opposite to the image as shown on I am using Python 64bit 2.7. I don't think this will cause me any problem in the future, but thought I would just check.

2) Are there any guides or advice on how to build a GUI. I have some experience using Visual Basic, but I can not seem to access all the tools to build a python GUI.


Dec 2, 2011 at 6:29 PM

Regarding 1) this is a difference between a manually configured interpreter and one which is picked up automatically from the registry.  If you're using a distribution installed normally (for all users) then it gets picked up perfectly fine.  If you happened to do a per-user install of a 64-bit build of Python then it gets picked up as a 32-bit install.  I believe the screen shot was in the later case and so I had manually registered the interpreter so it'd have the correct bitness.  I don't remember why Generate Completion Database is gray'd out in the screenshot though, it may be old enough that it pre-dates our ability to generate the completion DB for manually configured interpreters.

For 2) the best way to go currently is with IronPython and WPF support.  That has a built-in GUI designer that lets you drag and drop controls, it supports intellisense between the Python code and the XAML UI description, and you can double click on controls and automatically generate event handlers.  If you want to stick w/ CPython then you have a lot of frameworks to choose from but we don't have GUI designers for them: wxPython, PyQT, lib-tk, PyGame, PyWin32, and there's probably some I'm missing.

Dec 5, 2011 at 4:05 PM
Edited Dec 5, 2011 at 4:35 PM

Hi, thanks for your reply.

1) Are there any guides or help on how to use IronPython and Visual Studio. I am a little lost. I have both installed, and configured the interpreter, where can I go from here to learn more?

2) I do not seem to see "Python Application" when I select "New project", not like the many shown in the video.. (at around 8 mins). Why is this?

3) The Intellisense does not seem to work either? Is there maybe an installation problem?


Dec 5, 2011 at 5:21 PM

Do you have an "Other Languages" section in Installed Templates?

Can you go to Help->About Visual Studio and see if Python Tools for VS is listed in the installed extensions?  If you're using 1.1 alpha do you have a Tools->Python Tools->Diagnostic Info command?

Dec 5, 2011 at 6:10 PM

Hi dinov

1) To answer your questions, I can not seem to find "other langauges under the Installed templates. I have only Visual Basic, C, C++, F~, Python (but on "Python Application", Other project types, Database and Test Project.

2) Yes, I have Python tools for VS in the installed section:

- MS Python Tools for VS 1.0

- MS Python Tools for VS 1.1.41101.0

-MS Python Tools for VS - Profiling Support 1.1.41101.0

3) Under Tools ->Python Tools-> Diagnostic Info command, I have

        Id: 9a7a9026-48c1-4688-9d5d-e5699d47d074
        Factory: Python 64-bit
        Version: 2.7
        Arch: Amd64
        Path: C:\Python27\python.exe
        Windows Path: C:\Python27\pythonw.exe
        Path Env: PYTHONPATH


    Launcher: Microsoft.PythonTools.Project.DefaultLauncherProvider
        Launches and debugs Python programs.  This is the default.
        Standard Python launcher

I have also installed ActivePython, buthis still hasnt seemed to solve the problem. I can not seem to interact with it like shown on the video.

I look forward to any further suggestions, thanks.

Dec 5, 2011 at 6:17 PM

If you have the Python category in templates are there any project templates that show up when you click on that category?


Dec 5, 2011 at 6:53 PM

There is only project template for Python is "Python Application" (A project for creating a command-line application). I can not see Iron python or anything else there.

Thanks for your help and support.

Dec 5, 2011 at 7:22 PM

I suspect what happened is that you installed PTVS first and IronPython second.  In this case you may not have gotten the IronPython templates.  If you re-run the PTVS installer you can select "Change" at which point you will be able to install "IronPython Support".  That will give you the IronPython templates, including the WPF project template.

Dec 6, 2011 at 4:20 PM

Hi, I tried to re-run the installer, but it would not give me any options to install Ironpython support.

So I uninstalled Visual Studio 2010, then with IronPython installed, I reinstalled Visual Studio 2010.

This still have not solved the problem.

I would really appreciate any further suggestions. I can not understand why I am still having this problem. Thank you for your patience and understanding.

Dec 6, 2011 at 4:25 PM

When installing you'll need to click the Advanced button to get the option to select which features to install.

Dec 6, 2011 at 4:40 PM

I can only see "Custom" install and when I click on that, it gives me the options to install:

- MS VS 2010 Professional

    - Visual Basic

    - Visual C++

          - X64 Compilers and Tools

    - Visual C#

    - Visual F#

    - Visual Web Developer

    - Graphics library

Are there any detailed installation notes, I am not sure what I am missing out though. I follow the instructions on the website. The only difference is that my Python Interpreter options has "Remove Interpreter" greyed out and "Generate Compleition Database is active, but when I click on it, it does not seem to make any difference? Thanks.

Dec 6, 2011 at 5:56 PM

Sorry, I was referring to the advanced button in the PTVS installer.  General instructions should be:


Install VS (practically any set of options should be fine)

Install IronPython (only options that matter here are that IpyTools are disabled - this is the default in Ipy 2.7.1)

Install PTVS - You shouldn't have to check any options as long as the 1st two are already installed.  If you skip Ipy install then you'll need to go into advanced and select the IronPython support which will then light up when IronPython is installed.


There's a full set of installation instructions available here:

Dec 6, 2011 at 6:20 PM

Ok thanks, fantastic, that problem is sorted, now I have access to IronPython in the under new projects, (same as on your video tutorial).

Now to try to get intellisense to work. I tried writing some code, but there is no sign of intellisense?

Any ideas, thanks again

Dec 6, 2011 at 6:37 PM

Glad that's working!

Do you see anything after you type "import " at the top of a file?  Are you getting syntax highlighting?

One frequent cause of this is having IronPython Tools installed - and if you try and use IronPython's installer to Change the features it doesn't actually work.  You need to uninstall IronPython and re-install w/o the tools (this is usually only a problem w/ IronPython 2.7.0 as the tools don't install by default in 2.7.1)

Dec 7, 2011 at 7:29 AM

Yes, when I type import, as soon as I hit the "t" key it turns blue, so I guess syntax highlighting is working ok.

I have installed IronPython 2.7.1 64 bit.

Is there someway or switching Intellisense on and off? Maybe mine has been switched off?

Dec 7, 2011 at 7:58 PM

I don't think there's any way to disable intellisense in VS - are you getting intellisense w/ C#?  After you hit the t if you hit space do you see a list of modules to import?

Dec 8, 2011 at 8:00 AM
Edited Dec 8, 2011 at 1:51 PM


Yes intellisense seems to work fine in C# and other Visual Studio packages.

It still does not seem to work in PTVS, I just thought of something... does PTVS work if I use Python 64bit 2.7? I noticed in your youtube video that your python is just "Python 2.7", does it need to be the 32bit version to work?

Update: Tried it with "Python 2.7" and still no intellisense... any other ideas?

Strangly, it does highlight the open and closed bracket, recolour text, etc. but I just can get the intellisense to work.

Also, it does pick up the objects when I hover my mouse over the code as shown here

But in python after I type import and press space bar no intellisense pops up

Here is the intellisense working in Visual C#

Thanks for all your help, please let me know if there is any more information I can provide you to help to solve the problem. Thanks for your patience :-) I really look forward to getting this all up and running.

Dec 8, 2011 at 7:13 PM

It should work fine w/ Python 64-bit, both are supported. 

Do you have any other plugins installed (they'd be listed in Help->About Visual Studio)? 

What about ctrl-space? Does that do anything?  If not, and you go into Tools->Options->Environment->Keyboard and type in Show commands containing: Edit.CompleteWord and look at the shortcut key it's bound to (in Press shortcut keys) does that do anything if it's not already bound to Ctrl-Space?

Also, if you type in something simple like:

def f(): pass


Does goto definition (usually bound to F12, but also right click->Goto definition) work when you move the caret to the function call? 

The purpose of the questions is to figure out if our intellisense controller is active at all.  If it's not then we'll need to figure out why it's not getting loaded.  If it is then we'll need to figure out what, if anything, is interfering with it.  Usually we'll process space, ., ( and some other chars to kick off intellisense, but complete word and goto def are also handled by the intellisense controller.  Comment block (Ctrl-E C) might be another one to try.

Dec 8, 2011 at 8:06 PM

1) Here are all the plugins installed:

2) Ctrl + Space does not do anything.

Tools->Options->Environment->Keyboard, this is what is shown for Edit.CompleteWord (all other keyboard options are shown here)

When I press ctrl + K (twice), this is the outcome

3) When I type:

def f(): pass


and try F12, this occurs:

4) For Ctrl E, Ctrl C

When I press Ctrl+E

When I press Ctrl +C

Thanks, I hope this helps us to narrow down the cause.

I look forward to your response.

Dec 8, 2011 at 8:56 PM

The one odd thing I see here is in the plugins list you have both PTVS 1.0 and 1.1 Alpha (1.1.41101) installed.  I'm not sure how that could have happened, maybe there's an issue w/ our installer where it allows both to be installed in some order...  Are they both listed in add/remove programs?  If so you probably want to un-install them both and re-install 1.1 as uninstalling just one might remove some files the other needs. 

If they're not both listed in add/remove programs then you probably need to remove 1.0 from VS.  It'll be either in VSINSTALLDIR\Common7\IDE\Extensions\Microsoft\ or %LOCALAPPDATA%\Microsoft\VisualStudio\10.0\Extensions\Microsoft where you should find the directories:

IronPython Interpreter


Python Tools for Visual Studio

Python Tools HPC Support



And you can delete the 1.0 directories in each of those directories but keep the 1.1 directories. 

Dec 8, 2011 at 9:59 PM

Hi, yes this is a little odd. Not sure how this happened?

This is whats in my Common7\IDE\Extensions\Microsoft\ folder:

There is no sign of alpha 1.1.41101 (or any version of alpha in the add/remove programs section in control panel.

Tommorrow I will start from the beginning on a different PC and hopefully, I will get a successful set up this time..


Dec 8, 2011 at 10:09 PM

You'll need to go into the  Python Tools for Visual Studio and other folders and in there I think you'll find a 1.0 and 1.1 directories - if you want to keep 1.0 you can just delete the 1.1 directories.

Dec 9, 2011 at 8:03 AM
Edited Dec 9, 2011 at 4:47 PM

I have looked everywhere for 1.0, even run searches for it in all locations. Still no sign of 1.0. The strange thing is when I uninstall 1.1, they both vanish from the VS - Help - About, heres a screen capture of it:

Immediately after I installed PTVS 1.1 Beta 1.msi, here is the VS - Help - About after the PTVS 1.1 Beta 1.msi install, for some reason, both 1.0 and 1.1 have appeared

Just to be sure, I uninstalled 1.1 again and here is the VS - Help - About window: ('both' have gone again)


I installed 1.0 only, from

and now in VS - Help - About it shows "Microsoft Python Toosl for Visual Studio 1.0 " twice. Not sure if this is a problem or not?


Intelisense is now working!

I look forward to your comments.

Also, going back to the original post.. are there any tutorials or example of demostrating the building of GUI's from start to finish with PVTS, IronPython and WPF i.e. blank canvas to .exe type program? I need to learn this stuff ASAP ;-) thanks dinov

Dec 9, 2011 at 5:03 PM

In the after uninstall picture I see that you now have IronPython Tools installed - this comes from the IronPython installer and is also something you cannot have installed.


What I would recommend is the following steps:

   Un-install PTVS from Add/Remove Programs

   Un-install IronPython from Add/Remove Programs


Go to VSINSTALLDIR\Common7\IDE\Extensions\Microsoft\ and delete all of the directories:   

    IronPython Interpreter


    Python Tools for Visual Studio

    Python Tools HPC Support


    And if there's any other directories mentioning Python, delete those too.


Go to %LOCALAPPDATA%\Microsoft\VisualStudio\10.0\Extensions\Microsoft and delete all the same directories if they're there.

Re-install IronPython 2.7.1 ( which will not install the Tools by default - or if you have 2.7.0 and want to stick with it make sure the tools are disabled when installing.

Now re-install PTVS and things should be back to a good state.

I'm not sure that we have any videos right now...  You might want to check out Michael Foord's IronPython in Action book - it won't cover VS but it covers basic GUI w/ IronPython and would probably be a good reference, although it doesn't cover the new wpf.LoadComponent style of programming...  But I think you'll still find lots of useful stuff in there that will make it life easier.  I think I have it on my TODO list to make a video for this stuff, if I'm lucky I'll get to it next week :)


Dec 9, 2011 at 9:34 PM

I noticed IronStudio in the extensions folder too, is this part of IronStudio and should it be deleted from the extensions folder?

I very much hope to see the video very soon ;-) thanks

Dec 9, 2011 at 9:41 PM

Yep, IronStudio is part of the IpyTools which come with IronPython.  While it's probably not as problematic as the other extensions there's no reason to keep it around.

Dec 10, 2011 at 7:10 PM

Ok, all done and all healthy! :-)

Just need to learn as much as I can in a short space of time. Can you recommend any online material that might help me build GUIs with Visual Studio and Python? Been through all the fantastic videos posted up for PTVS on youtube.