Re: [Tutor] Advanced python recommendations

2018-10-10 Thread Alan Gauld via Tutor
On 10/10/18 10:53, Mariam Haji wrote: >...my current challenge > with the projects bit is how to pseudo-code and which approach to use as I > am not very familiar with the entire python syntax and how I can use it And that's the whole point of doing projects. You need to really be comfortable

Re: [Tutor] Advanced python recommendations

2018-10-09 Thread Alan Gauld via Tutor
On 09/10/18 20:09, Mariam Haji wrote: > Hi guys, I am on the last exercises of learn python the hard> by Zed.A Shaw > and I am looking for recommendations on what > to follow next or what book to try next The main thing is to write a lot of code, so think of a project and build it. The

Re: [Tutor] [spoiler] Re: Shifting arrays as though they are a 'word'

2018-10-09 Thread Alan Gauld via Tutor
On 09/10/18 17:32, Mark Lawrence wrote: > On 09/10/18 17:10, Alan Gauld via Tutor wrote: >> On 09/10/18 13:45, Chip Wachob wrote: >> >>> Another related question. How do I know I want to do dir(int) vs.. I >>> don't know dir(long)? >> >> Because y

Re: [Tutor] [spoiler] Re: Shifting arrays as though they are a 'word'

2018-10-09 Thread Alan Gauld via Tutor
On 09/10/18 14:21, Chip Wachob wrote: > The API is providing me with a bytearray-formatted result, but the API > only reads one whole byte, or eight bits, at a time. Being slightly picky but an octet and a byte are subtly different. An octet is a group of 8 bits with no meaning attached. So an

Re: [Tutor] [spoiler] Re: Shifting arrays as though they are a 'word'

2018-10-09 Thread Alan Gauld via Tutor
On 09/10/18 13:45, Chip Wachob wrote: > Another related question. How do I know I want to do dir(int) vs.. I > don't know dir(long)? Because you want to convert the byte array into an int. And there is no long in Python... > And, when I do dir(int) I get the following results. I must not be >

Re: [Tutor] [spoiler] Re: Shifting arrays as though they are a 'word'

2018-10-09 Thread Alan Gauld via Tutor
On 09/10/18 02:55, Chip Wachob wrote: > This bit stream is complicated in that I have to reverse the bytes as > well since I'm reading off the 'end' of a bunch of registers. So, the > MSByte comes to me first and goes into the [0] location and the extra > bits get added to the '0th' end of the

Re: [Tutor] [spoiler] Re: Shifting arrays as though they are a 'word'

2018-10-09 Thread Alan Gauld via Tutor
On 09/10/18 02:48, Chip Wachob wrote: >> bytearray(b'\x00\xff\x7f\x00') >> py> n = int.from_bytes(b, 'big') > > I'm not familiar with this int.from_bytes. > > Being new to Python, I don't have a mental library of these nifty > functions. How / where does one find a library of these wonderful >

Re: [Tutor] Shifting arrays as though they are a 'word'

2018-10-05 Thread Alan Gauld via Tutor
On 05/10/18 21:17, Chip Wachob wrote: > > I have an array of bytes. Up to 64, which makes for 512 bits. > > I am reading these bytes in serially, and once I have a collection of > them, I want to shift them by 'n' bits. The size of the array and the > number of bits are both variable up to the

Re: [Tutor] Numpy documentation

2018-10-04 Thread Alan Gauld via Tutor
On 04/10/18 20:02, Roger Lea Scherer wrote: > In the example pictured below, the array has 2 axes. The first axis has a > length of 2, the second axis has a length of 3. > [[ 1., 0., 0.], > [ 0., 1., 2.]] > > (I think) I understand the 2 axes. [1,0,0] (I'm lazy and don't want to type > the

Re: [Tutor] Running programs that import 3rd party packages installed using pip.

2018-10-04 Thread Alan Gauld via Tutor
On 04/10/18 15:15, Roger B. Atkins wrote: > That's very helpful, thanks. After reading the Tutor information last > night, I wrote a little program I named sysinfo. The code run line by > line in a Spyder console yields: > > In [3]: sys.path > Out[3]: > ['', >

Re: [Tutor] coding problem

2018-10-04 Thread Alan Gauld via Tutor
On 04/10/18 05:22, ramanpreet baidwan wrote: > Can anyone tell me how to code to display permutations in a table > for all values of z=x^2+y by getting input from user for range of x and y? There are several problems with your question. First it sounds suspiciously like homework and we won't do

Re: [Tutor] Running programs that import 3rd party packages installed using pip.

2018-10-04 Thread Alan Gauld via Tutor
On 04/10/18 04:20, Roger B. Atkins wrote: > System: Windows 10, Anaconda, Python 3, Spyder3 > > I changed my system path variable to include: > C:\Users\rba21\Anaconda3\lib\site-packages# Result: same error message When you say the "system path" do you mean the PYTHONPATH variable? It's

Re: [Tutor] tkinter

2018-09-30 Thread Alan Gauld via Tutor
On 30/09/18 02:22, Jorge Herrera wrote: > Hello, I'm new to Python and I've been having a frustrating time with > python because I'm trying to import tkinter and it's saying that tkinter is > not defined, that it doesn't exist That suggests that Tkinter is not installed on your system. What OS

Re: [Tutor] Installing new modules

2018-09-29 Thread Alan Gauld via Tutor
On 28/09/18 20:03, Rahul Koparde wrote: > How to install twilio module in python? Searching "python install twilio" on Google yielded: https://stackoverflow.com/questions/51985401/how-to-install-twilio-via-pip It may help. -- Alan G Author of the Learn to Program web site

[Tutor] Fwd: How to roughly associate the values of two numpy arrays, or python lists if necessary

2018-09-19 Thread Alan Gauld via Tutor
Forwarded to list I have, I suspect, an elementary problem that I am too inexperienced to resolve. I have two numpy arrays, each representing the values of a specific property of a set of cells. Now, I want to associate the two values for each cell, that is

Re: [Tutor] Clean the Shell

2018-09-11 Thread Alan Gauld via Tutor
On 11/09/18 23:31, Denis Dzhindo wrote: > Hello! > May I know, how I can clean the Shell, I'm not sure what you mean by that, however, if you mean reset the IDLE shell back to square one there is a menu option to restart the shell. Shell->Restart Shell. If you mean the command line interpreter

Re: [Tutor] IDLE

2018-09-11 Thread Alan Gauld via Tutor
On 11/09/18 19:57, Roger Lea Scherer wrote: > Can you direct me to where or how to update from Python 3.6.5 Shell, I > think it is also called IDLE 3.6.5, to Python 3.7 Shell? The Python shell and IDLE are really two different things. The shell is normally considered to mean the interactive

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Alan Gauld via Tutor
On 10/09/18 19:15, Chip Wachob wrote: > So I see why my .join() isn't working. I'm not sure how to fix it though. I already showed you the sum() function. It can take a list of lists and add them together end_array = sum(results,[]) > My background is in C and other 'historical' languages,

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Alan Gauld via Tutor
On 10/09/18 04:00, Chip Wachob wrote: > I presume that I need to instantiate an array of slice_size-sized bytearrays. Cameron has already addressed this and explained that you don't need to and if you did how to do it. I'd only add that you need to readjust your thinking when it comes to Python

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Alan Gauld via Tutor
On 08/09/18 03:15, Chip Wachob wrote: > my function's main pieces are: It would probably be better to post the entire function, a partial code sample like this just gives us an inkling of what you are trying to do but not enough to be sure of where the errors lie. > def transfer_byte_array(): >

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Alan Gauld via Tutor
On 08/09/18 03:15, Chip Wachob wrote: > Admin, please remove my earlier messages. No can do, once the emails are sent by the server they are out there on the net, stored in people's mailboxes and in various internet archives. When using a mailing list always check before sending, there's no

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Alan Gauld via Tutor
On 08/09/18 04:57, Chip Wachob wrote: > was my attempt at 'setting' the type of the variable. A variable in Python is just a name. It has no type. Only values have types. So you can set (or change) the type of a value but not of a variable. > Coming from a 'C' background, I find the lack of

Re: [Tutor] localhosting

2018-09-06 Thread Alan Gauld via Tutor
On 06/09/18 20:09, Roger Lea Scherer wrote: > I removed the "3" in "python3" and it works; along with moving the "www" > folder to where python resides. Thanks for the help. That may appear to work but I suspect its just hiding the real issue which is about setting the correct path values. Did

Re: [Tutor] Writing for loop output to csv

2018-09-06 Thread Alan Gauld via Tutor
On 06/09/18 17:32, Brandon Creech wrote: > Hi, I am working to forecast the temperatures for the next 5 days using an > API and a for loop. I would like write the output of this loop to a csv in > this format:: > > Columns: City, min1, max1, min2, max2,min3,max3,min4,max4,min5,max5 > data:

Re: [Tutor] Python

2018-09-06 Thread Alan Gauld via Tutor
On 06/09/18 04:14, Donna Black via Tutor wrote: > How do we save our work on python? IDLE hasn’t installed itself on my > computer Which OS are you using? That will help us find/install IDLE. However, you don't need IDLE to work with Python, just a text editor. If I assume you are using

Re: [Tutor] Fwd: Accessing variables from other modules

2018-09-05 Thread Alan Gauld via Tutor
On 05/09/18 18:12, Chip Wachob wrote: > In your examples name1 and name2 could be anything that is contained > in that module.. a variable, function, class, etc.. correct? Correct. They are just names. Again a difference between Python and C. In C a name is a label associated with a memory

Re: [Tutor] Fwd: Accessing variables from other modules

2018-09-05 Thread Alan Gauld via Tutor
On 05/09/18 15:06, Chip Wachob wrote: > Okay, I think I'm starting to get a handle on the visibility of > things. As you said, much different than C. Yes. The significant thing is to remember that in Python you are importing names. In C you include the contents of the file. #include Lets you

Re: [Tutor] Fwd: Accessing variables from other modules

2018-09-05 Thread Alan Gauld via Tutor
On 05/09/18 14:05, Chip Wachob wrote: > # module AdafruitInit.py > # from the Adafruit tutorials.. > import Adafruit_GPIO.FT232H as FT232H > import Adafruit_GPIO as GPIO > > FT232H.use_FT232H() > > ft232h = FT232H.FT232H() > > # config settings for the SPI 'machine' > spi = FT232.SPI(ft232h, 4,

Re: [Tutor] Fwd: Accessing variables from other modules

2018-09-05 Thread Alan Gauld via Tutor
On 05/09/18 04:12, Chip Wachob wrote: > # module RSI.py > def write(byte): >spi.write(byte) You don't have any import statements here. You need to import spi to use it. > # toggle the latch signal >ft232h.output(5, GPIO.LOW) >ft232h.output(5, GPIO.HIGH) And the same for ft232h >

Re: [Tutor] Accessing variables from other modules

2018-09-04 Thread Alan Gauld via Tutor
On 04/09/18 16:10, Chip Wachob wrote: > (like I would do in C). I then used the import statement to 'include' > them into the main.py file. OK a basically good idea but how did you use the import statement? There are many forms: import foo from foo import name1, name2,... from foo import *

Re: [Tutor] I found the octal and hexadecimal direct conversion method

2018-09-02 Thread Alan Gauld via Tutor
On 02/09/18 14:27, kanzan wrote: > ☻ I found direct method of octal and hexadecimal conversions ☻ (without > using binary or decimal) I'm not sure what you mean but numbertheory has been around for along time and has long had methods to convert from one base to another (not just computer bases

Re: [Tutor] REG : Pexpect timeout issue

2018-09-01 Thread Alan Gauld via Tutor
On 01/09/18 12:41, krishna chaitanya via Tutor wrote: > Below is my code, i am frequently hitting timeout issue to login to linux or > router. Have you tried extending the timeout? > child = spawn('su x',timeout = 50) What is the timeout interval? If its in milliseconds then 50 is much

Re: [Tutor] OT: How to automate the setting of file permissions for all files in a collection of programs?

2018-08-30 Thread Alan Gauld via Tutor
On 30/08/18 10:30, Cameron Simpson wrote: >> That is inherent in using version control systems. > ...> state. Personally I use mercurial which does include the permissions in the > state. Ah, interesting. I've never found a VC system that preserved permissions. Usually they zap everything to

Re: [Tutor] A Python program to Summarise weather results?

2018-08-30 Thread Alan Gauld via Tutor
On 30/08/18 03:56, Matthew Polack wrote: > Hi, > > We have a spreadsheet from a local weather station.it summarises the > amount of rainfall per day since 1863. > >

Re: [Tutor] localhosting

2018-08-30 Thread Alan Gauld via Tutor
On 30/08/18 00:09, Roger Lea Scherer wrote: > I'm trying to implement a local host. My instructions tell me to type the > following command in the command line, make sure I'm in the "www" folder So this is not the folder where python3 is installed. (See below) > python3 -m http.server --cgi 8000

Re: [Tutor] OT: How to automate the setting of file permissions for all files in a collection of programs?

2018-08-30 Thread Alan Gauld via Tutor
On 30/08/18 04:44, boB Stepp wrote: > good news side we went from the vi editor to Vim/gVim; from Python 2.4 > to 2.7; in addition to Tkinter there is now a Python interface to GTK; > went from no SQLite to having it; and a few other goodies that Hooray!!! > system installed, SCCS (RIP!) went

Re: [Tutor] How to have unique identifiers for multiple object instances of a given class?

2018-08-28 Thread Alan Gauld via Tutor
On 28/08/18 02:53, boB Stepp wrote: > Wouldn't a single JSON file be wasteful? If I used this program for a > couple of years or so and habitually played a lot of solitaire, that > would be a lot of stuff to load into RAM when on any given solitaire > session I might only play one to three kinds

Re: [Tutor] How to have unique identifiers for multiple object instances of a given class?

2018-08-27 Thread Alan Gauld via Tutor
On 27/08/18 04:58, boB Stepp wrote: > So you are saying do something like: > > class SolitaireGame(): > def __init__(self, name): > self.name = name > > def describe_self(self): > print("This game of solitaire is called", self.name, ".") > > game_objects = {} > def

Re: [Tutor] Hi This is Michael Munn and I’m interested of the Python programming language.

2018-08-26 Thread Alan Gauld via Tutor
On 26/08/18 18:42, Michael Munn wrote: > I’m using Python 3.6 and I heard a friend of mine told me that He write his > code using a word processer called Note pad plus some thing like that to > code. I assume you are on Windows OS? In which case you probably mean Notepad++ (like in the C++

Re: [Tutor] How to have unique identifiers for multiple object instances of a given class?

2018-08-26 Thread Alan Gauld via Tutor
On 26/08/18 23:38, boB Stepp wrote: > class SolitaireGame(): > def __init__(self, name): > self.name = name > Say I go with the aforementioned game with 13 separate scores to keep > track of. The names of these games might be "Two_Mastery", > "Three_Mastery", ... , "Ace_Mastery".

Re: [Tutor] Accessing a tuple of a dictionary's value

2018-08-24 Thread Alan Gauld via Tutor
On 24/08/18 10:02, Alan Gauld via Tutor wrote: > CCing list, please always use Reply-All or Reply-List when responding > to the tutor list so that everyone gets a chance to reply. > > > On 24/08/18 00:35, Roger Lea Scherer wrote: >> >> Lots of code missing,

Re: [Tutor] Accessing a tuple of a dictionary's value

2018-08-24 Thread Alan Gauld via Tutor
CCing list, please always use Reply-All or Reply-List when responding to the tutor list so that everyone gets a chance to reply. On 24/08/18 00:35, Roger Lea Scherer wrote: > > Lots of code missing, but the line I'm interested in is this: > print("Your number  " + str(numerator) + "/" +

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-23 Thread Alan Gauld via Tutor
On 23/08/18 05:47, Matthew Polack wrote: > Hi Alan, > > I'm working my way through some of the tips you provided and tried to use > the code givenbut am getting an error at Line 75 in my code re: not > enough arguments for format string > > _ > return self.func(*args) > File

Re: [Tutor] Accessing a tuple of a dictionary's value

2018-08-22 Thread Alan Gauld via Tutor
On 22/08/18 17:27, Mats Wichmann wrote: > I'm really unfond of accessing members of a collection by numeric index. > > >>> numer, denom = d["twothirds"] > >>> print(numer, denom) > (2, 3) > > I think that's nicer than: numer = d["twothirds][0] You can alsao avoid indexes with the

Re: [Tutor] Next step in learning programming with Python

2018-08-22 Thread Alan Gauld via Tutor
On 22/08/18 15:45, JGledhill via Tutor wrote: > I'm at the point where I want to actually start "programming",> and solving > problems by thinking through them, not just copying code examples. Well done, it's good to recognise that stage in your development. > Any recommendations on how I can

Re: [Tutor] Getting started with Pandas

2018-08-22 Thread Alan Gauld via Tutor
On 22/08/18 11:29, Rafael Knuth wrote: > my code below did not require a return statement, hence I was assuming > it wouldn't be needed in my function either. return is only used inside a function, it makes no sense outside (and is a syntax error). Its purpose is to return a value to the caller

Re: [Tutor] Accessing a tuple of a dictionary's value

2018-08-22 Thread Alan Gauld via Tutor
On 21/08/18 23:27, Roger Lea Scherer wrote: > I can't find anything in StackOverflow or Python documentation specifically > about this. They talk about accessing a list or a tuple or a dictionary, > but not when the value is a tuple or list. The value is irrelevant youi access the value in

Re: [Tutor] Getting started with Pandas

2018-08-22 Thread Alan Gauld via Tutor
On 22/08/18 07:46, Rafael Knuth wrote: > import pandas as pd > cities_lst = pd.read_table("cool_cities.csv") > cities_lst.head() > > I was trying to rewrite the above as a function. > Unlike my code above, my function below did not return the first 5 > rows, but just nothing: > > def

Re: [Tutor] Building a Package

2018-08-21 Thread Alan Gauld via Tutor
On 21/08/18 14:10, Glenn Schultz via Tutor wrote: > Either I am a complete moron or packaging python is a poorly documented > nightmare.   I suspect the latter is true to some extent. To be fair Python packaging was a complete mess for many years with competing technologies and tools. It is

Re: [Tutor] Question

2018-08-21 Thread Alan Gauld via Tutor
On 21/08/18 12:16, Jacob Braig wrote: > I am just starting out coding and decided on python. It looks like you are using Python v2 (maybe v2.7?) but the latest version is 3.7 and for beginners we normally recommend adopting v3. It doesn't change anything much in this case but it saves you

Re: [Tutor] Recommended way for end users to run our Python programs?

2018-08-19 Thread Alan Gauld via Tutor
On 19/08/18 12:11, Abdur-Rahmaan Janhangeer wrote: > btw qpython supports sl4a since long > > maybe you meant : "no packaged options" Never heard of sl4a, ... OK I did a search. Its a scripting interface to the Android API that supports Python. It looks interesting, next time I have a spare week

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-17 Thread Alan Gauld via Tutor
On 17/08/18 03:19, Matthew Polack wrote: > def viewPercent(): > percentCalc = score/total*100 > rounded = round(percentCalc, 2) > percentViewLab["text"] = rounded Since you only want the rounded value for display this is usually achieved using string formatting: >>> s = "Here is a

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-17 Thread Alan Gauld via Tutor
On 17/08/18 03:19, Matthew Polack wrote: > 1.) Centre feature > > When I use txt.insert I need to use the feature Peter found... > > center = txt.tag_config("center", justify="center") > txt.insert(0.0, result, "center") > > but in the Enter label section...I could just use it straight

Re: [Tutor] Recommended way for end users to run our Python programs?

2018-08-17 Thread Alan Gauld via Tutor
On 17/08/18 05:40, Matthew Polack wrote: > Does this always require Python being installed as a full language on the > end users computer? No. It does require the Python interpreter plus any modules you write or use(including any modules your modules use...) There are a few tools around that

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-16 Thread Alan Gauld via Tutor
On 16/08/18 08:18, Matthew Polack wrote: > The last remaining issue is the program does not calculate the percentage > right when you make mistakes...it just keeps giving a result of 100%. > def percentCheck(): > global percentScore > global score > global mistakes > global total

Re: [Tutor] Need PYTHON, MySQL, WEB2PY OR DJANGO Tutor

2018-08-16 Thread Alan Gauld via Tutor
On 15/08/18 18:45, Hamid Nehoray via Tutor wrote: > Greetings, Greetings, welcome to the tutor list. > I'm an old programmer who has some old ERP systems... > I need somebody to teach me the new ways using Python, For anyone who can already program I always recommend starting with the official

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-15 Thread Alan Gauld via Tutor
On 15/08/18 10:18, Peter Otten wrote: > Matthew Polack wrote: > >> *Question 2:* >> Is there a way to centre text within the text frame? I can change the font >> and size...but don't know how to centre it? > > Ok, I wanted to know it myself, and found > >

Re: [Tutor] understanding Python naming conventions & semantics

2018-08-15 Thread Alan Gauld via Tutor
On 15/08/18 08:32, Rafael Knuth wrote: > I am trying to wrap my head around naming conventions & semantics in Python. A good question with a none to simple answer. In truth some of it goes back to essentially arbitrary decisions made by Guido vanRossum when he originally designed Python! The

Re: [Tutor] Times Tables Program that constantly tells you that you are wrong!

2018-08-15 Thread Alan Gauld via Tutor
On 15/08/18 01:56, Matthew Polack wrote: > from tkinter import * > > import random > > answer = "global" You have the right concept but the wrong implementation. To declare a variable as global you declare it as normal in the outer scope then inside each function that uses it add a global line

Re: [Tutor] Query: lists

2018-08-14 Thread Alan Gauld via Tutor
On 14/08/18 22:38, Cameron Simpson wrote: > If you're trying to partition words into values starting with "x" and values > not starting with "x", you're better off making a separate collection for the > "not starting with x" values. And that has me wondering what the list "b" in > your code

Re: [Tutor] Query: lists

2018-08-14 Thread Alan Gauld via Tutor
On 14/08/18 23:16, Peter Otten wrote: > For a simple solution you do need a and b: leave words unchanged, append > words starting with "x" to a and words not starting with "x" to b. > > Someone familiar with Python might do it with a sort key instead: Or, for one definition of simple, a list

Re: [Tutor] Query: lists

2018-08-14 Thread Alan Gauld via Tutor
On 14/08/18 09:11, Deepti K wrote: > when I pass ['bbb', 'ccc', 'axx', 'xzz', 'xaa'] as words to the below > function, it picks up only 'xzz' and not 'xaa' Correct because > def front_x(words): > # +++your code here+++ > a = [] > b = [] > for z in words: > if z.startswith('x'):

Re: [Tutor] Is there a better way to write my code?

2018-08-14 Thread Alan Gauld via Tutor
On 14/08/18 07:56, Rafael Knuth wrote: > List comprehension is really cool. One thing I like about list > comprehension is that you can get a dictionary, tuples or lists as a > result by just changing the type of braces. > > # dictionary > colors = ["red", "blue", "white", "yellow"] > colors_len

[Tutor] Fwd: Re: Argparse Error

2018-08-13 Thread Alan Gauld via Tutor
Forwarding to list since I seem to have messed up the address last time... Forwarded Message Subject:Re: [Tutor] Argparse Error Date: Sun, 12 Aug 2018 23:44:04 +0100 From: Alan Gauld Reply-To: tutor To: Nathan Johnson On 12/08/18 19:58, Nathan Johnson

Re: [Tutor] Counting the # of iterations OR storing # values in a list

2018-08-13 Thread Alan Gauld via Tutor
On 13/08/18 06:15, Gautam Desai wrote: > I am currently working with the lattice.py code attached. The server doesn't like attachments so strips them off for security. As a result we can't see the code. Please resend, but paste the code into the body of your message (in plain text to preserve

[Tutor] [OT] Re: Need help in learning Python

2018-08-13 Thread Alan Gauld via Tutor
This thread is getting seriously off topic, but I'm interested so I'm letting it run... :-) On 13/08/18 07:46, Wallis Short wrote: > To learn Ubuntu, I would recommend installing Windows Subsystem for Linux > onto your existing Windows 10 setup and then get the Ubuntu (or SUSE and > Debian) from

Re: [Tutor] Argparse Error

2018-08-12 Thread Alan Gauld via Tutor
On 12/08/18 18:59, Nathan Johnson wrote: > Here is what comes out when I use the command for each program. > > Command Prompt: > C:\Users\natha> C:\WINDOWS\PROMPT> python D:\Python\bytsh.py > D:\Video\test.mp4 > 'C:\WINDOWS\PROMPT' is not recognized as an internal or external command, > operable

Re: [Tutor] Argparse Error

2018-08-12 Thread Alan Gauld via Tutor
On 12/08/18 16:52, Nathan Johnson wrote: > Okay so I downloaded and saved the script as a .py file in a folder named > Python on the D; Drive, and also moved my video file to a folder in my D: > drive with the name Video. I tried using it in Command Prompt, Python, and > Python IDLE, but I got the

Re: [Tutor] Argparse Error

2018-08-12 Thread Alan Gauld via Tutor
On 12/08/18 00:51, Nathan Johnson wrote: > Hello I am trying to glitch video files for artistic purposes by using a > scrip I found on Reddit (linked below). This is the first time I have tried > to use Python and I need some help with an error that I keep getting after > I input this first part

Re: [Tutor] Need help in learning Python

2018-08-11 Thread Alan Gauld via Tutor
On 11/08/18 18:48, Carlos Monge wrote: > have learned To do those sections I need to install Pygame and make sure I > have 'pip' as well as Matplotlib. If you are using a recent Python (v3.4+) then pip should already be installed. PyGame comes with a Windows installer that should set everything

Re: [Tutor] Syntax question

2018-08-09 Thread Alan Gauld via Tutor
On 09/08/18 05:10, Matthew Polack wrote: > I'm trying to configure a button that prints a variable and calls a > function at the same time...but I can't figure out how to get the syntax > right...or if this is even possible: Of couse its possible just wrap it in a higher level function: def

Re: [Tutor] python3 - °F/°C printing those degree signs

2018-08-07 Thread Alan Gauld via Tutor
On 07/08/18 22:32, Evuraan wrote: print('\u00b0'+ " F") > ° F > > Elsewhere, it no longer seem to work: > > $ python3 > Python 3.5.2 (default, Nov 23 2017, 16:37:01) > [GCC 5.4.0 20160609] on linux > Type "help", "copyright", "credits" or "license" for more information. import

Re: [Tutor] How to write a function which reads files

2018-08-07 Thread Alan Gauld via Tutor
On 07/08/18 13:46, Rafael Knuth wrote: > Now I want to convert the code above into a function. > This is what I wrote: > > def FileReader(file_path): > with open(file_path) as file_object: > contents = file_object.read > return contents > >

Re: [Tutor] Getting current listbox item index and bind it to button (Tkinter)

2018-08-07 Thread Alan Gauld via Tutor
On 06/08/18 20:50, Ali M wrote: > If i delete this line "self.textbox.delete(1.0, tk.END)" in my > enter_meaning function the listbox items won't lower down to 1 item and i > just want 1 item to be shown after user searches the item in entrybox. So just display 1 item. What you are currently

Re: [Tutor] Getting current listbox item index and bind it to button (Tkinter)

2018-08-04 Thread Alan Gauld via Tutor
On 04/08/18 09:07, Ali M wrote: > I have taken the delete statement out of the for loop, but still nothing > happens when i click the button. You never assign the search_word function to a widget either via the command option or via a bind statement. If you don't bind the function to a widget

Re: [Tutor] Counting Items on a List associated w/ Index #

2018-08-03 Thread Alan Gauld via Tutor
On 03/08/18 12:14, Rafael Knuth wrote: > I wrote a function which is supposed to count the number of items on > each index #. > For starters, here's a list I created to test the function: > > properties = ["mansion, modern, swimming_pool" , "mansion, historic, > air_conditioning", "penthouse,

Re: [Tutor] try, except syntax

2018-08-02 Thread Alan Gauld via Tutor
On 02/08/18 15:29, Shall, Sydney wrote: > uvc = 2 > msg = "Bad argument provided, the value of uvc must be a float." > > try: >     type(uvc) == float > except TypeError as e: >     print(e, msg) The try block contains an expression that will always evaluate to True or False and thus never

Re: [Tutor] Getting current listbox item index and bind it to button (Tkinter)

2018-08-02 Thread Alan Gauld via Tutor
On 02/08/18 21:12, Ali M wrote: > I tried writing the search_word function and binded it to the button, but > it doesn't work, please help i'm still a beginner. > > def search_word(self, tag): > esperanto = self.listbox.selection_set(0) > results = self.cur.execute("SELECT

Re: [Tutor] Any ideas why this woudn't work?

2018-08-01 Thread Alan Gauld via Tutor
On 01/08/18 14:17, Matthew Polack wrote: > > c:\Python>python crops3.py > Traceback (most recent call last): >   File "crops3.py", line 30, in >     filemenu.add_command(label="Show", command=self.showImg) > NameError: name 'self' is not defined The problem with cutting and pasting/copying

Re: [Tutor] SSL Error

2018-08-01 Thread Alan Gauld via Tutor
On 01/08/18 05:07, Saket Mehrotra wrote: > Hi > > I am also not using any Open SSL package. > I have just added " import requests" in py file. And when I run the module > I get the SSL package error ,not sure why. Then you really need to send the complete error message and the code that

Re: [Tutor] SSL Error

2018-07-31 Thread Alan Gauld via Tutor
On 31/07/18 03:52, Saket Mehrotra wrote: > error ssl.PROTOCOL_SSLv23: OpenSSL.SSL.SSLv23_METHOD, > AttributeError: module 'ssl' has no attribute 'PROTOCOL_SSLv23' Are you sure you spelled the attribute correctly? Have you tried >>> import ssl >>> dir(ssl) Top see what the attribute names

Re: [Tutor] Dictionary viceversa

2018-07-30 Thread Alan Gauld via Tutor
On 30/07/18 19:11, Zachary Ware wrote: > On Mon, Jul 30, 2018 at 1:08 PM Alan Gauld via Tutor wrote: >> There are lots of options including those suggested elsewhere. >> Another involves using get() which makes your function >> look like: >> >> def viceversa(d): &

Re: [Tutor] How to add an Image in Grid mode with Python and Tkinter?

2018-07-30 Thread Alan Gauld via Tutor
On 30/07/18 08:24, Matthew Polack wrote: > I'm trying to simply add an image to our program to make the GUI more > interesting...but most of the tutorials describe using the 'Pack' > method not the grid method of layout... That's completely irrelevant since you can add images to widgets

Re: [Tutor] Dictionary viceversa

2018-07-30 Thread Alan Gauld via Tutor
On 30/07/18 13:40, Valerio Pachera wrote: > users = {'user1':['office-a', 'office-b'], > 'user2':['office-b'], > 'user3':['office-a','office-c']} > > It's a list of users. > For each user there's a list of room it can access to. > > I wish to get the same info but "sorted" by room.

Re: [Tutor] Do something on list elements

2018-07-27 Thread Alan Gauld via Tutor
On 27/07/18 23:32, Cameron Simpson wrote: >> for index, s in l: >> l[index] = s.replace('X','') >> print(l) > > I think you meant: > > for index, s in enumerate(l): Oops, yes. Sorry. >> In Python you very rarely need to resort to using indexes >> to process the members of a collection.

Re: [Tutor] Do something on list elements

2018-07-27 Thread Alan Gauld via Tutor
On 27/07/18 13:56, Valerio Pachera wrote: > l = ['unoX', 'dueX'] > c = 0 > for n in l: > l[c] = l[c].replace('X','') > c = c + 1 > print (l) > --- > > it works but I wonder if there's a better way to achieve the same. Yes, a much better way. for index, s in l: l[index] =

Re: [Tutor] how to change the command "string" on a tkinter Button?

2018-07-27 Thread Alan Gauld via Tutor
On 27/07/18 11:55, Shall, Sydney wrote: > On 01/07/2018 11:19, Steven D'Aprano wrote: >> Even better would be to learn a form of VCS (version control system) >> such as Mercurial (hg) or git. Depending on the text editor you are >> using, it may have VCS integration available. > > Does Spyder

Re: [Tutor] Everything in one file?

2018-07-18 Thread Alan Gauld via Tutor
On 18/07/18 17:00, Alan Gauld via Tutor wrote: > Now the child class must import parent and dereference > Parent within its module. (ie use parent.Parent) > > So two classes is more work for you and more work > for the interpreter. Oops, that should be two *files* is more

Re: [Tutor] Stuck on some basics re floats

2018-07-18 Thread Alan Gauld via Tutor
On 18/07/18 14:10, Matthew Polack wrote: > Thanks for the reply Alan. > > I found another fix where I could just use this: > > num1 =int(input('Ener inches here?: ')) > > > but a lot of people like yourself seem to be recommending this > 'float' method. It all depends whether your input is a

Re: [Tutor] Everything in one file?

2018-07-18 Thread Alan Gauld via Tutor
On 18/07/18 14:46, Shall, Sydney wrote: > > is no need to put every class in a separate file, and it usually leads > > to complicated dependencies and circular imports. > I have constructed a program which has a parent class and a child class > and I have them in two different files. I import

Re: [Tutor] Stuck on some basics re floats

2018-07-18 Thread Alan Gauld via Tutor
On 18/07/18 00:52, Matthew Polack wrote: > Hi, > > I'm a teacher trying to learn Python with my students. > > I am trying to make a very simple 'unit calculator' program...but I get an > error ..I think python is treating my num1 variable as a text string...not > an integer. You are correct. >

Re: [Tutor] Does Python 2.7 bdist_wininst perform checksum verification?

2018-07-17 Thread Alan Gauld via Tutor
On 17/07/18 07:26, Jeanne Ruiz wrote: > I can't seem to find documentation in docs.python.org that talks > about > whether or not the Python Build Distribution command, > bdist_wininst performs checksum verification upon installing > a Windows executable *.exe. That's probably a bit off topic

Re: [Tutor] putting accent on letters while user is typing in Entrybox (Tkinter)

2018-07-16 Thread Alan Gauld via Tutor
On 16/07/18 18:29, Ali M wrote: > The accents which i want to be automatically converted and put upon letters > is circumflex and another one which shape is like the opposite of > circumflex. It doesn't really matter what the shapes are provided the result is a unicode character. You just want

Re: [Tutor] help with reading a string?

2018-07-16 Thread Alan Gauld via Tutor
On 16/07/18 23:28, Crystal Frommert wrote: > are learning how to read from a txt file and search for a string. > > Here is a sample of text from the txt file: > TX,F,1910,Mary,895 > TX,F,1910,Ruby,314 > TX,F,1910,Annie,277 > > How do they read the number after a certain searched name and then

Re: [Tutor] putting accent on letters while user is typing in Entrybox (Tkinter)

2018-07-15 Thread Alan Gauld via Tutor
On 15/07/18 20:44, Ali M wrote: > Hi. I want to write these (ĝ, ĉ, ĵ, ĥ, ŭ, ĉ) accented letters when the user > types (gx, cx, jx, ux, cx). > > when user types 'gx' for example i want to remove that x and replace it > with the accent. how should i do that? and how should i specify which > accent

Re: [Tutor] Wish to upgrade Python 3.6.5 to Python 3.6.6 for Linux Mint 19

2018-07-14 Thread Alan Gauld via Tutor
On 14/07/18 22:51, boB Stepp wrote: > Linux Mint 19 comes with Python 3.6.5 pre-installed. However, my son > and I are working on a couple of things together, and decided to use > the latest bugfix releases of Python 3.6 for them. I would not think > that upgrading from 3.6.5 to 3.6.6 would

Re: [Tutor] changing font

2018-07-13 Thread Alan Gauld via Tutor
On 13/07/18 18:42, Talia Koch via Tutor wrote: > Hi, I am trying to figure out a code that would change my text output to > 'Arial' It all depends on how you are displaying your text. If it is in a GUI such as Tkinter or WxPython you can change the font in yor program. But the technique is

Re: [Tutor] learn python to build payment processor

2018-07-11 Thread Alan Gauld via Tutor
On 11/07/18 22:41, Anil Duggirala wrote: > Will the Django tutorial guide me toward connecting > Python and SQL? Yes, Django has its own mechanism for doing that and the tutorials will cover it. > Could you share a link to your SQL tutorial See the signature. On the left hand contents frame

Re: [Tutor] learn python to build payment processor

2018-07-11 Thread Alan Gauld via Tutor
On 11/07/18 14:55, Anil Duggirala wrote: > I would like to ask what for recommendations on > books/resources to learn python to build a payment processor. You don;t tell us your experience level. If you can already program in any other language then just use the standard Python tutorial on

Re: [Tutor] Need all values from while loop - only receiving one

2018-07-07 Thread Alan Gauld via Tutor
On 07/07/18 18:46, Daryl Heppner wrote: > I'm stepping back to simply return the DealID from the XML using the > concept of a class. My code results in exit code 0 but doesn't print > any results. Could you give me a hint where I'm missing something? You have an issue which has shown up in

<    1   2   3   4   5   6   7   8   9   10   >