Re: [Tutor] getting back my listbox items

2018-06-24 Thread Alan Gauld via Tutor
On 24/06/18 18:26, Ali M wrote: Just a quick observation, its too late to read it in detail... > def update_list(self): > search_term = self.search_var.get() > for item in self.listbox.get(0, tk.END): > if search_term.lower() in item: > self.listbox

Re: [Tutor] CSV Read

2018-06-25 Thread Alan Gauld via Tutor
On 25/06/18 20:35, Giulia Marcoux wrote: > Hello, > > I am a student learning python, and i am running into some difficulties. I > am tryign to read a csv file that has different delimiters for different > rows: Example: > > Format:V1.1 > Model: R > Step Size: 10mm > Distance: 10cm > Gain: 1000

Re: [Tutor] programmer raspberry

2018-06-29 Thread Alan Gauld via Tutor
On 29/06/18 10:08, Mathieu Sollier wrote: > Bonjour, > J’essaye de programmer un Raspberry pi 3 modèle B+ composé d’un écran tactile > devant notamment allumé mon pc via cette interface. > Auriez vous des conseils pour réaliser cela ? et pour l’interface graphique ? > Cordialement. > Provenance :

Re: [Tutor] CSV Read

2018-06-29 Thread Alan Gauld via Tutor
On 29/06/18 13:18, Sergio Rojas wrote: > # read the whole file > with open(thefilename, 'r') as theFile: contentfile = theFile.read() > > # split the file in lines according to the newline character "\n" > templines = [] > for line in contentfile.splitlines(): > templines.append(line.str

Re: [Tutor] RAD GUI Development (like Visual Studio/VBA)

2018-06-29 Thread Alan Gauld via Tutor
On 29/06/18 16:05, Glen wrote: > Can someone advise on a RAD, drag and drop style graphical form/dialog > creator? Akin to VBA or Visual Studio that will work with Python? There is nothing even close to the VB GUI builder for Python. That's because Python has to cover many GUI frameworks, VB onl

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

2018-06-30 Thread Alan Gauld via Tutor
On 30/06/18 03:55, Chris Roy-Smith wrote: > I am trying to change the command of a tkinter Button in my program. > Eventually I want to be able to do this to many buttons. Since I'm not 100% sure if you mean the command or the label or both here is a simple example that does both... ###

Re: [Tutor] RAD GUI Development (like Visual Studio/VBA)

2018-06-30 Thread Alan Gauld via Tutor
On 30/06/18 11:50, Shall, Sydney wrote: >> And if you want to try using Jython or MacPython(?) >> you can use the native GUI builders for those: >> - Eclipse/Netbeans (Java) >> - XDeveloper (MacOS) - I tried this once and it kind of works... >> > Alan, > > Could you expand a bit on the use of XDe

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

2018-07-01 Thread Alan Gauld via Tutor
On 01/07/18 09:15, Chris Roy-Smith wrote: >> def cmd2(): print('This is number 2') > I was hoping eventually to generate the command form the results of a > database query, not knowing  the exact command until run time. Perhaps > what I was trying to achieve is too close to self modifying code,

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

2018-07-01 Thread Alan Gauld via Tutor
On 01/07/18 11:33, Chris Roy-Smith wrote: >> Even better would be to learn a form of VCS (version control system) > I don't know anything about these tools, VCS store versions of a file. You can check for differences between versions, restore previous versions, even merge different versions. Mo

Re: [Tutor] why can use a widget assigned to a variable or just use it on it's own?

2018-07-02 Thread Alan Gauld via Tutor
On 02/07/18 02:54, Chris Roy-Smith wrote: > If I have grasped things correctly a widget is an object. Every value in Python is an object. numbers, strings, lists, functions, instances of classes. All are objects. You can see that by using the dir() function on them: >>> dir(5) ['__abs__', '__a

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

2018-07-02 Thread Alan Gauld via Tutor
On 01/07/18 23:34, Alan Gauld via Tutor wrote: > Realize that you made a mistake, get the original > version back > > co -l -v1.1 myfile.py Oops, a bit rusty. The command should be: co -l1.1 myfile.py -- Alan G Author of the Learn to Program web site http://www.alan-g

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

2018-07-02 Thread Alan Gauld via Tutor
On 02/07/18 21:06, Daryl Heppner wrote: > I'm trying to calculate the amount of rent per lease for the life of > the lease, by month. The following code provides the correct results > except for the monthnum and billper. > The while loop (below) returns the first value correctly but stops > w

Re: [Tutor] Help

2018-07-03 Thread Alan Gauld via Tutor
On 03/07/18 06:23, Adam Jones wrote: > Good day, I am currently checking a piece of arcpy code. Where a point is > shifted within a set distance to protect the privacy of said point. Please > see the code below, and please advise me or correct the code where it is > needed It would help us to help

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

2018-07-03 Thread Alan Gauld via Tutor
On 02/07/18 23:52, Daryl Heppner wrote: > The two While Loops are the part I'm struggling with. The goal is to > list each bill month number and date for each month in the term. When you need multiple values you need to use a collection type such as a list or tuple. Your problem is that you are u

Re: [Tutor] C++ or Python?

2018-07-03 Thread Alan Gauld via Tutor
On 03/07/18 14:48, Bellamy Baron wrote: > I have heard C++ is faster than python and I have a few questions > 1.Is there a way to make python run just as fast Kind of. Nearly. But its limited to specific types of program. The most common approach is to identify the slow bits and rewrite them in C

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

2018-07-03 Thread Alan Gauld via Tutor
On 03/07/18 20:39, Daryl Heppner wrote: > The idea of a class is something I'd unsuccessfully tried but I'm up > for the challenge! I'm very comfortable in Transact SQL but OOP is > new to me. OK, What I meant by using a class was to define one (or more?) that encompassed all the data in one De

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

2018-07-03 Thread Alan Gauld via Tutor
On 04/07/18 01:08, Alan Gauld via Tutor wrote: > # Now the main code just needs the outer loops: > tree = ET.parse(r'\\DealData.xml') > root = tree.getroot() > deals = [] > for deal in root.findall("Deals"): > for dl in deal.findall("Deal"): &g

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

2018-07-04 Thread Alan Gauld via Tutor
On 04/07/18 12:08, Daryl Heppner wrote: > If you have any suggestions for continued self-learning (books, > courses, etc.) I'd appreciate any tips. So far as OOP goes you can't go far wrong with the latest version of Grady Booch's OOAD book. I've read both the previous versions and the latest upd

Re: [Tutor] Using pip

2018-07-05 Thread Alan Gauld via Tutor
On 05/07/18 17:03, Hlavin, Matthew (GSFC-5460)[GSFC INTERNS] wrote: > install the library using the line: > $ pip install -U pyvisa > When I type this line, I get a syntax error The most common reason is that you are trying to type it at the Python >>> prompt. It should be typed at the OS prompt.

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 seve

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 pyth

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] 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 compl

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 brea

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 g

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 ad

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 to

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] 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] 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 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 f

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] 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 have

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] = s.re

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. And

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

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 regar

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] 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 loo

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 genera

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 code..

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 Eng

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 rai

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, mod

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 it

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 doing

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 > > print(FilePrinter("C:\\Users\\...\\

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 platfor

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 newfu

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] 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 o

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 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 pr

[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] 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 f

[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] 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

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] 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 co

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 was

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] 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 othe

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 > > https://stackoverflow.com/questions/4256

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-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] 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 can

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 away..wit

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 st

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] 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 relearn

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 only

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 cities(file_

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 exactl

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 o

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 b

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 namedtu

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 "Timespict

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 06:10, Matthew Polack wrote: > I'm also trying to solve the rounding issue...but can't work out the syntax > using the example provided...have tried this but I get an error... > > def viewPercent(): > percentCalc = score/total*100 > percentViewLab["text %.2f"] % percentCalc

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) + "/" + str(denom

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, but the lin

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". In

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++ progra

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 make_

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] 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 by

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] 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. > > http://www.bom.gov.au/jsp/ncc/cdio/weatherData/av?p_nccObsCode=136&p_display_type=dailyDataFile&p_startYear=1863&p_c=-1249186659

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

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 to

Re: [Tutor] "Python not recognized as a command"

2018-09-01 Thread Alan Gauld via Tutor
On 01/09/18 18:40, Dana O'Connor wrote: > I've been trying to download and use Python 3.7 for the past few days How exactly did you download it (from which site and in which format?) And how did you then install it? > every time I try to open it it tells me I don't have "pip" That seems unlik

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 but

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 * impo

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] 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, 200

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 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 addr

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 Window

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] 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 y

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 ty

<    6   7   8   9   10   11   12   13   14   15   >