[Tutor] Copy/Paste in Tkinter

2017-02-04 Thread Pooja Bhalode
Hi, I am trying to write a simple Tkinter code in Python in order to demonstrate select/copy/paste/cut functionalities using keyboard keys and menu options. I tried looking up online, but I am finding examples of these in which they create an event and then it is used: eg.: import Tkinter def mak

[Tutor] Tkinter Copy/Paste/Cut functionalities

2017-02-04 Thread Pooja Bhalode
Hi, I am new to tkinter and looking for some help with select/copy/paste functionalities. I wish to keep these tabs in the Edit menu and as well as be able to do it using the shortcut keys. Here, I am trying to create a GUI and needed some help with that. I came across some snippets of the code to

Re: [Tutor] Copy/Paste in Tkinter

2017-02-04 Thread Alan Gauld via Tutor
On 04/02/17 00:24, Pooja Bhalode wrote: > I am trying to write a simple Tkinter code in Python in order to > demonstrate select/copy/paste/cut functionalities using keyboard keys and > menu options. You are going a fairly long winded way about it. Rather than generating events use the Text/Entry

Re: [Tutor] Tkinter Copy/Paste/Cut functionalities

2017-02-04 Thread Alan Gauld via Tutor
On 04/02/17 02:34, Pooja Bhalode wrote: > I came across some snippets of the code to do this but using a self class. I'm not sure what you mean by a "self class"? > I was wondering if some one could help me create these functionalities in a > manner similar to the following code. (similar to the

Re: [Tutor] Copy/Paste in Tkinter

2017-02-04 Thread Alan Gauld via Tutor
On 04/02/17 16:09, Pooja Bhalode wrote: > I do not have a text box, but a GUI similar to a word editor. That sounds like a text box to me!? What are you using to enter the text if not a Text widget? > I was learning from youtube videos about this. You can start with the GUI topic in my tutorial

Re: [Tutor] Using venv

2017-02-04 Thread Juan C.
On Fri, Jan 27, 2017 at 7:47 PM, Jim wrote: > > [...] This question seems a little dumb and maybe I am being a little dense, > but then what? Imagine that you are working on 5 different Python projects, each using different packages with different versions. We can break this down in two situatio

Re: [Tutor] Copy/Paste in Tkinter

2017-02-04 Thread Pooja Bhalode
Hi Alan, Thank you so much for guiding me towards this. I am new to tkinter hence not aware of all these features. I am trying to find some simple examples, of how to use copy/paste/cut. I do not have a text box, but a GUI similar to a word editor. I was wondering if you could direct me towards or

[Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread boB Stepp
py3: a ['Mary', 'had', 'a', 'little', 'lamb', 'break'] py3: for w in a: ... print(w) ... print('Huh?') File "", line 3 print('Huh?') ^ SyntaxError: invalid syntax I don't understand why this throws a SyntaxError. If I wrap essentially the same code into a function it works: py3

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread David
On 5 February 2017 at 09:02, boB Stepp wrote: > py3: a > ['Mary', 'had', 'a', 'little', 'lamb', 'break'] > py3: for w in a: > ... print(w) > ... print('Huh?') > File "", line 3 > print('Huh?') > ^ > SyntaxError: invalid syntax > > I don't understand why this throws a SyntaxError.

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread boB Stepp
On Sat, Feb 4, 2017 at 4:40 PM, David wrote: > On 5 February 2017 at 09:02, boB Stepp wrote: >> py3: a >> ['Mary', 'had', 'a', 'little', 'lamb', 'break'] >> py3: for w in a: >> ... print(w) >> ... print('Huh?') >> File "", line 3 >> print('Huh?') >> ^ >> SyntaxError: invalid syn

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread David
On 5 February 2017 at 09:56, boB Stepp wrote: > On Sat, Feb 4, 2017 at 4:40 PM, David wrote: >>> >>> I don't understand why this throws a SyntaxError. If I wrap >>> essentially the same code into a function it works: >> >> From [1]: "When a compound statement is entered interactively, it must >>

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread Alan Gauld via Tutor
On 04/02/17 22:56, boB Stepp wrote: > On Sat, Feb 4, 2017 at 4:40 PM, David wrote: >> On 5 February 2017 at 09:02, boB Stepp wrote: >>> py3: a >>> ['Mary', 'had', 'a', 'little', 'lamb', 'break'] >>> py3: for w in a: >>> ... print(w) >>> ... print('Huh?') >>> File "", line 3 >>> print('H

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread boB Stepp
On Sat, Feb 4, 2017 at 5:44 PM, Alan Gauld via Tutor wrote: > On 04/02/17 22:56, boB Stepp wrote: >> On Sat, Feb 4, 2017 at 4:40 PM, David wrote: >>> On 5 February 2017 at 09:02, boB Stepp wrote: py3: a ['Mary', 'had', 'a', 'little', 'lamb', 'break'] py3: for w in a: ...

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread Ben Finney
boB Stepp writes: > But would it not be more consistent to assume the user knows what he > is doing based on the new (lack of) indentation being used, accept > that a new section of code outside of the for loop is being typed in, > and wait for the blank line before executing everything typed in?

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread boB Stepp
I'm beginning to believe I am being incredibly dense today ... On Sat, Feb 4, 2017 at 6:16 PM, Ben Finney wrote: > boB Stepp writes: > >> But would it not be more consistent to assume the user knows what he >> is doing based on the new (lack of) indentation being used, accept >> that a new secti

[Tutor] Function annotations

2017-02-04 Thread boB Stepp
I just finished looking at https://docs.python.org/3/tutorial/controlflow.html#function-annotations and skimming through PEP 484--Type Hints (https://www.python.org/dev/peps/pep-0484/). My initial impression is that the purpose of function annotations is to enable static code analysis tools like l

Re: [Tutor] Function annotations

2017-02-04 Thread Steven D'Aprano
On Sat, Feb 04, 2017 at 08:50:00PM -0600, boB Stepp wrote: > I just finished looking at > https://docs.python.org/3/tutorial/controlflow.html#function-annotations > and skimming through PEP 484--Type Hints > (https://www.python.org/dev/peps/pep-0484/). My initial impression is > that the purpose o

[Tutor] sort() method and non-ASCII

2017-02-04 Thread boB Stepp
Does the list sort() method (and other sort methods in Python) just go by the hex value assigned to each symbol to determine sort order in whichever Unicode encoding chart is being implemented? If yes, then my expectation would be that the French "รก" would come after the "z" character. I am not r

Re: [Tutor] Function annotations

2017-02-04 Thread boB Stepp
On Sat, Feb 4, 2017 at 9:23 PM, Steven D'Aprano wrote: > On Sat, Feb 04, 2017 at 08:50:00PM -0600, boB Stepp wrote: >> Of course, these are >> apparently optional. I now wonder if I should be endeavoring to add >> these to my code? > > Do you run a linter? If not, there doesn't seem much point i

Re: [Tutor] sort() method and non-ASCII

2017-02-04 Thread eryk sun
On Sun, Feb 5, 2017 at 3:52 AM, boB Stepp wrote: > Does the list sort() method (and other sort methods in Python) just go > by the hex value assigned to each symbol to determine sort order in > whichever Unicode encoding chart is being implemented? list.sort uses a less-than comparison. What you