Free Republic
Browse · Search
General/Chat
Topics · Post Article

To: amorphous
Those ten lines of code may require ten thousand lines ...

I understand and appreciate all that. It's true of any modern programming language nowadays, not just python.
52 posted on 12/28/2015 3:28:15 PM PST by SpaceBar
[ Post Reply | Private Reply | To 51 | View Replies ]


To: SpaceBar; tacticalogic
Python is interpreted at run-time, line by line, like other script languages (e.g, basic, perl, php, ruby).

An interpreted language is a programming language in which programs are 'indirectly' executed ("interpreted") by a interpreter program running in the background. This interpreter program eats up hardware resources a single running "compiled program" wouldn't in most cases.

A compiler is a computer program (or set of programs) that transforms source code, written in a programming language (the source language), into another computer language (the target language, often having a binary form known as object code).

A compiled language (e.g. C/C++, Pascal, even VB, etc.) is converted into minimal machine code and then 'directly' executed by the host CPU/MPU. It's faster and requires fewer hardware resources.

I realize you probably already know most of this - I'm just not sure why you seem to be stumbling over it. Anyway, I just wanted to spelled it out for those who may read the thread and do not know the difference.

57 posted on 12/28/2015 4:09:26 PM PST by amorphous
[ Post Reply | Private Reply | To 52 | View Replies ]

To: SpaceBar
Python 3 code that generates a window and exit button. Not sure how the formating will turn out. :-)


from tkinter import *

class Window(Frame):

 def __init__(self, master=None):
  Frame.__init__(self, master)

  self.master = master

  self.init_window()

 def init_window(self):

  self.master.title("GUI")

  self.pack(fill=BOTH, expand=1)

  quitButton = Button(self, text="Quit", command=self.client_exit)

  quitButton.place(x=20, y=20)

 def client_exit(self):
  exit()

root = Tk() root.geometry("400x300")

app = Window(root)

root.mainloop()

93 posted on 12/29/2015 9:15:56 AM PST by amorphous
[ Post Reply | Private Reply | To 52 | View Replies ]

Free Republic
Browse · Search
General/Chat
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson