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

2018-06-29 Thread Glen
Hey guys,

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?

I currently use the PyCharm IDE, which is fantastic. But I don't have the
time or the skill to craft it all by hand.

Thanks,
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


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

2018-06-29 Thread Mats Wichmann
On 06/29/2018 09:05 AM, Glen wrote:
> Hey guys,
> 
> 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?
> 
> I currently use the PyCharm IDE, which is fantastic. But I don't have the
> time or the skill to craft it all by hand.

The difficulty with this question is there are so many GUI toolkits for
Python, you first have to figure out which one you want to target.

There's Tkinter, which is one of the batteries in the Python "batteries
included" concept; however many articles and blogs which talk about what
to use instead start with a statement that Tk is ugly, so I presume it
must be true if so oft repeated.

There is also Qt by way of PyQt (or PySide), Gtk+ (pyGObject), wxPython,
PyForms, PyGui, fltk, Kivy, just to rattle off a few - I'm sure there
are more.

In my limited experience, I know some people were quite happy with using
Qt Designer and then generating Python code from the result - there's a
tool for that (pyuic?).  But last I heard about doing this was years and
years ago and the state of the art has probably advanced.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] CSV Read

2018-06-29 Thread Sergio Rojas


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

> X,Y
> 1,3
> 2,5
> 6,5
> 5,7
>

Hi Giulia,

When dealing with unformatted data files, a first quick approach
is to read in using standard python routines to read the file
and then proceed via looping the lines of the file. Here is a 
very crude code to deal with your sample
(in what follows  represents indentations):

# Say you have named your data file "thefile.dat"

thefilename = "./thefile.dat" # Assign the filename to a variable

# read the whole file
with open(thefilename, 'r') as theFile:
>>> contentfile = theFile.read()

# print(contentfile) # peruse the file content. Find patterns to extract data

# split the file in lines according to the newline character "\n"
templines = []
for line in contentfile.splitlines():
 templines.append(line.strip())

#Following the pattern extract the data
thelines = []
for line in templines:
>>>if ':' in line:
>>temp = line.split(":")
>>for i in range(len(temp)):
try:
temp[i] = float(temp[i])
except:
temp[i] = temp[i]
>>print(temp)
>>thelines.append(temp)
>>>elif ',' in line:
>>temp = line.split(",")
>>for i in range(len(temp)):
try:
temp[i] = float(temp[i])
except:
>>>temp[i] = temp[i]
>>print(temp)
>>thelines.append(temp)
>>>else: # not necessary
pass
# print(thelines) # check a few lines

# Improve the code to deal with large files (big data stuff)
# your turn ...

# make a pandas data frame from the data
import pandas as pd
import numpy as np

mypdframe = pd.DataFrame(np.array(thelines))

print(mypdframe)

Hope this set your learning of python not too stressful,
so you could appreciate its power.

Sergio

Check out the free first draft of the book:
Prealgebra via Python Programming

https://www.researchgate.net/publication/325473565
Companion web site:
  https://github.com/rojassergio/Prealgebra-via-Python-Programming





___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] programmer raspberry

2018-06-29 Thread Mathieu Sollier
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 : Courrier pour Windows 10

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


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 : Courrier pour Windows 10

For the non-french speakers I ran that through Google translate:

---
Hello,
I try to program a Raspberry pi 3 model B + composed of a touch screen
in front of lit my pc via this interface.
Do you have any tips for doing this? and for the graphical interface?
Cordially.
Provenance: Mail for Windows 10
-

But it didn't help me much, maybe somebody else knows?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


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.strip())
>
> #Following the pattern extract the data
> thelines = []
> for line in templines:

You might as well just use readlines()...

Or better still use for on the file itself:

with open(thefilename, 'r') as theFile
for line in theFile:
   


 if ':' in line:
>>> temp = line.split(":")
>>> for i in range(len(temp)):
> try:
> temp[i] = float(temp[i])
> except:
> temp[i] = temp[i]

def makeFloats(sep, line):
temp = line/split(sep)
for i,v in enumerate(temp)
try:
  temp[i] = float(v)
except ValueError,TypeError: pass
return temp

if ':' in line: line = makeFloats(':', line)
if(',' in line: line = makeFloats(',', line)

# into pandas next...


Although I'm not totally sure that is what the OP wanted.
What happens about the header lines for example?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


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 only has to deal with one. Which is why VB is pretty
much useless for anything other than Windows...

But there are some GUI tools available:
- Glade  - PyQt/Side?
- SpecTcl - Tkinter
- Dabo - WxPython (customised for simple DB apps)

I've tried all of them and only Dabo worked for me,
but Davo wasn't really suitable for my particular
project at the time. But YMMV

There are some others I haven't tried too
- Kivy, Blackadder(??)

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 G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor