You are not logged in.

#1 2014-08-10 16:29:03

RichAustin
Member
From: Wakefield, Yorkshire, England
Registered: 2011-07-27
Posts: 186

Python development environment

Hi All

Can anyone point me in the direction of a good tutorial on setting up a Python development environment? I've got the basics working okay, but I'm having problems with installing tkinter correctly. I particularly want to get a virtualenv up and running correctly.

PyCharm is complaining about my references to tkinter. I've looked on the Net for a way to resolve the issues but couldn't find anything. I'm just hoping that someone on here can point me in the right direction.

# This line didn't work :-
#from tkinter import *
# This line works perfectly :-
import tkinter as tk, importlib, sys

# These lines do not work :-
from tkSimpleDialog import askstring
from tkFileDialog   import asksaveasfilename
from tkMessageBox import askokcancel

I'm running python 3.4.1 at the moment with PyCharm Community Edition 3.4. I am new to Python, I need to learn as part of being a tutor for Code Club and Code Club Pro http://www.codeclubpro.org/ . I work as a developer in Visual Studio / SQLServer so I understand programming okay, it's just getting the darn system setup!

Thanks for reading
Richard

Offline

#2 2014-08-10 18:45:08

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: Python development environment

For virtualenv: did you try the Wiki? https://wiki.archlinux.org/index.php/Python_VirtualEnv

As for your import problem, this is a good example on where using an IDE complicates / confuses things, I doubt it has anything to do with PyCharm: see http://legacy.python.org/dev/peps/pep-0404/#imports for changes to the import statement in Python 3, specifically "star imports".

Offline

#3 2014-08-11 06:34:06

RichAustin
Member
From: Wakefield, Yorkshire, England
Registered: 2011-07-27
Posts: 186

Re: Python development environment

twelveeighty wrote:

For virtualenv: did you try the Wiki? https://wiki.archlinux.org/index.php/Python_VirtualEnv

As for your import problem, this is a good example on where using an IDE complicates / confuses things, I doubt it has anything to do with PyCharm: see http://legacy.python.org/dev/peps/pep-0404/#imports for changes to the import statement in Python 3, specifically "star imports".

twelveeighty

Thanks for the reply, I'll take a look at what you've suggested as soon as I get a chance.

Richard

Offline

#4 2014-08-11 23:45:22

mike_r
Member
Registered: 2009-01-22
Posts: 114

Re: Python development environment

RichAustin wrote:

# These lines do not work :-

from tkSimpleDialog import askstring
from tkFileDialog   import asksaveasfilename
from tkMessageBox import askokcancel

I can't claim to understand everything that is going on, but you are mixing some python2 and python3 things. For your stated examples, try

from tkinter.simpledialog import askstring
from tkinter.filedialog import asksaveasfilename
from tkinter.messagebox import askokcancel

There is apparently a lot of renaming going on. A little extra Google-fu will turn up some examples. I drew upon http://docs.pythonsprints.com/python3_p … rting.html and http://www.daniweb.com/software-develop … -3-tkinter.


Linux User #353 - SLS -> Slackware -> Red Hat -> Mandrake -> Fedora -> Arch

Offline

Board footer

Powered by FluxBB