Starting Python development

Contribute code to SolydXK and make it even better.
User avatar
Arjen Balfoort
Site Admin
Posts: 8759
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Starting Python development

Postby Arjen Balfoort » 22 Jul 2013 09:46

Here's a nice example of using PIL to crop/resize an image:

Code: Select all

import os
import sys
import Image
import ImageOps


def resizeImg(originalPath, savePath, width, height):
    if os.path.exists(originalPath) and originalPath != savePath:
        try:
            size = (width, height)
            thumb = ImageOps.fit(originalPath, size, Image.ANTIALIAS)
            thumb.save(savePath, "PNG")
        except IOError:
            print "cannot create thumbnail for '%s'" % originalPath
Taken from: http://stackoverflow.com/questions/1386 ... uare-image
but I haven't tested it.

Whatever you do, leave out the face recognition: most people don't even use a picture of themselves.
For reference: http://creatingwithcode.com/howto/face- ... th-python/

If you have coding problems, you can always post them here.


SolydXK needs you!
Development | Testing | Translations

elija
Posts: 14
Joined: 06 Jul 2013 10:35

Re: Starting Python development

Postby elija » 01 Aug 2013 10:40

I've spent a little while looking at the Python and it is starting to make more sense. Glade on the other hand is driving me insane!

Is there a good tutorial that you would recommend which would enable me to get more out of glade than being told that I can't do that?

User avatar
Arjen Balfoort
Site Admin
Posts: 8759
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Starting Python development

Postby Arjen Balfoort » 01 Aug 2013 11:29

I don't know any, just taught myself, but I found a nice looking one when I googled: http://www.micahcarrick.com/gtk-glade-t ... art-1.html

It's Gtk+, but he's using Python2 as a back-end. Python3 differs slightly.

If you have any questions, you can start a topic in this forum. I'll help you as good as I can.


SolydXK needs you!
Development | Testing | Translations

User avatar
Arjen Balfoort
Site Admin
Posts: 8759
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Starting Python development

Postby Arjen Balfoort » 01 Aug 2013 11:50

I just uploaded SolydXK Conky to github: https://github.com/Schoelje/solydxk-conky

I use Python3 and Gtk+ there.
Maybe you can take a look at it.
The main script to look at is conky.py
There the glade file is called, and objects initiated.


SolydXK needs you!
Development | Testing | Translations

elija
Posts: 14
Joined: 06 Jul 2013 10:35

Re: Starting Python development

Postby elija » 01 Aug 2013 11:51

Cheers for that. I'll have a look at the weekend. It may turn out to be easier to get my head around Glade by building an interface from nothing rather than trying to amend one.

On another note, if anyone wants to get a good introduction to Python, I found this on my journeys. It makes no assumption of programming experience and introduces the concepts in a sensible order.

User avatar
Arjen Balfoort
Site Admin
Posts: 8759
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Starting Python development

Postby Arjen Balfoort » 01 Aug 2013 12:02

Added your link to the OP.
Thanks!


SolydXK needs you!
Development | Testing | Translations

ray
Posts: 111
Joined: 31 May 2013 04:54
Location: New Zealand
Contact:

Re: Starting Python development

Postby ray » 01 Aug 2013 22:48

elija wrote:Cheers for that. I'll have a look at the weekend. It may turn out to be easier to get my head around Glade by building an interface from nothing rather than trying to amend one.

On another note, if anyone wants to get a good introduction to Python, I found this on my journeys. It makes no assumption of programming experience and introduces the concepts in a sensible order.
Doesn't work with Iceweasel according to their main page.

Ray

elija
Posts: 14
Joined: 06 Jul 2013 10:35

Re: Starting Python development

Postby elija » 02 Aug 2013 07:02

Interesting, it definitely works in Firefox, Chrome and Midori. I wonder what Iceweasel and iceape don't support? They are both a bit older than the others. It might be worth contacting CodeAcademy.

kunaguvarun
Posts: 4
Joined: 22 Oct 2013 15:02

Re: Starting Python development

Postby kunaguvarun » 23 Oct 2013 03:45

Hello everyone,

I always found vogella's tutorials to be good enough for beginners. Here is the link for learning about GIT

http://www.vogella.com/articles/Git/article.html

User avatar
samriggs
Posts: 247
Joined: 03 Nov 2013 22:55
Location: Canada

Re: Starting Python development

Postby samriggs » 04 Jan 2014 05:49

Installed glade and ninja, I been threatning myself to learn python for a couple years now it's about time I get at it.
I'll start this after I get the icons and themes done (I'll make sure that's done first ;) )
It's just one language I never learnt yet and want it on my list, plus I have some apps I wouldn't mind making for linux and maybe some plugins for my beloved gimpers, I used to make them for photoshop back in the day in C.
Sam

"Windows, the worst system for too much money, Linux, the best system for free"
SolydK 64bit SolydX 32bit
Registered Linux User #545430

User avatar
Arjen Balfoort
Site Admin
Posts: 8759
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Starting Python development

Postby Arjen Balfoort » 04 Jan 2014 08:00

A designer AND developer?
I think you need to add another userbar ;)


SolydXK needs you!
Development | Testing | Translations

User avatar
samriggs
Posts: 247
Joined: 03 Nov 2013 22:55
Location: Canada

Re: Starting Python development

Postby samriggs » 04 Jan 2014 09:42

:lol: not quite yet for that one.
I know a few languages, java, most of the web ones, xml, css, html, javascript etc, I used to know php good and mysql, I used to program in C++ and C but it's been awhile, but it won't take me much to get back into it, I just for some reason never got around to learning python yet, so I'll be learning it after I get the theme and icons out of the way, it should be too much different from the other ones.
Usually once you know a couple there all pretty much the same except for header files.
I used glade before but it was years ago, but it shouldn't be too difficult hopefully to jump back into it.
I got QT to get back into C++ once I get some free time but it looks like python is the way to go now.
I might try a new plmouth screen also with the progress bar going in stages around the logo, I guess it might too difficult to gradually make it go around but I'm sure I can do stages instead revealing images around it, unless I can mask a gradient progress , still trying to figure that one out, just haven't seen one like that before so it got my curiosity up trying to figure out how to do it.
Sam

"Windows, the worst system for too much money, Linux, the best system for free"
SolydK 64bit SolydX 32bit
Registered Linux User #545430

User avatar
Arjen Balfoort
Site Admin
Posts: 8759
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Starting Python development

Postby Arjen Balfoort » 04 Jan 2014 10:30

If you know one language, it's not that difficult to learn the other. Especially when you know Java, and C. You'll see that Python has been derived from them.

Plymouth scripting is rather primitive: it's a one-file-javascript-to-do-all
Testing is a real pain :evil:


SolydXK needs you!
Development | Testing | Translations

User avatar
samriggs
Posts: 247
Joined: 03 Nov 2013 22:55
Location: Canada

Re: Starting Python development

Postby samriggs » 04 Jan 2014 12:57

I checked out a bit of python, it's seemed fairly fimilar and much of the same old stuff, I don't think it'll take me long to pick it up.
:lol: ya plymouth can be a total pain in the buit to test, if it's wrong oooppss
I made one theme for myself when I had cinnamon on this thing, I just thought it might look cool having a loading bar moving around the logo instead of a normal progress bar or dots, just something different if I can figure it out.
Maybe I'll use the old clunker to test it on if I figure it out, I'm not so worried about killing an already almost dead system, plus I would just reinstall that thing if I totally borked it.
I can't wait to get into python though and back to glade again (once I figure it out again, it's been awhile) sort of almost reminds me of the old visual basics software abit, more basic but a tiny bit similar, oh ya I used to know visual basics dim witted language also years ago :lol: and lingo (same crap but for shockwave), I don't even think that one is around anymore.
Got to come up with some useful stuff, I hope anyways, or at least help out a bit.

"Windows, the worst system for too much money, Linux, the best system for free"
SolydK 64bit SolydX 32bit
Registered Linux User #545430

pamfeuer
Posts: 29
Joined: 04 Apr 2014 04:19

Re: Starting Python development

Postby pamfeuer » 21 Apr 2014 03:03

Thank You Very Much Schoelje for your insight and guidance.
Looking forward to being a python pro..... :lol:
fx-6300@ 4.5ghz kooled by zalman cnps10x performa+As5, 970fx extreme4, 16GB ddr3 1600mhz, various hdd, various OS(linux's, win, OSx mavericks, pcbsd10, androidx86(but useless)), various wifi cards and usb dongles, zotac 650ti boost 2gb.

User avatar
Arjen Balfoort
Site Admin
Posts: 8759
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Starting Python development

Postby Arjen Balfoort » 21 Apr 2014 07:38

After the 201404 ISOs I will update all sources on Github: https://github.com/SolydXK
Just send me a PM if you want to work on a project.


SolydXK needs you!
Development | Testing | Translations

pamfeuer
Posts: 29
Joined: 04 Apr 2014 04:19

Re: Starting Python development

Postby pamfeuer » 22 Apr 2014 05:11

:lol: Thanks Schoelje.
Im battling against time trying to learn, work and like what I do.
I will surely pitch in once I have enough python skillzz.
Thank You.
fx-6300@ 4.5ghz kooled by zalman cnps10x performa+As5, 970fx extreme4, 16GB ddr3 1600mhz, various hdd, various OS(linux's, win, OSx mavericks, pcbsd10, androidx86(but useless)), various wifi cards and usb dongles, zotac 650ti boost 2gb.

User avatar
ScottQuier
Posts: 1781
Joined: 18 Jul 2013 15:55
Location: Newport News, VA

Re: Starting Python development

Postby ScottQuier » 22 Apr 2014 11:35

pamfeuer wrote::lol: Thanks Schoelje.
Im battling against time trying to learn, work and like what I do.
I will surely pitch in once I have enough python skillzz.
Thank You.
I can relate! Python is much more a language than I had, at first, been led to believe. It's going to take me a bit longer than usual to pick this thing up.

And then, there's the whole Gtk object model I have to learn.

And glade.

And ....

But, I'll get there 'cause I really want to.
Scott
Quoting zerozero, "The usage of PPA's in debian-based
systems is risky at best and entails serious compatibility
problems; usually it's the best way to destroy an install"

User avatar
Arjen Balfoort
Site Admin
Posts: 8759
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Starting Python development

Postby Arjen Balfoort » 22 Apr 2014 12:01

Check these references for Python3 / Gtk+:
https://developer.gnome.org/gtk3/stable/
http://docs.python.org/3/library/index.html

Stackoverflow is a good place to search for answers:
http://stackoverflow.com/


SolydXK needs you!
Development | Testing | Translations

Deleted User 2764

Re: Starting Python development

Postby Deleted User 2764 » 14 May 2014 21:51

I am trying to learn Python/Glade but no luck. In the repos is glade version 3 and I installed it (along with devhelp). However links that were mentioned here (I'll repost below and the other I googled and found but thought it was more updated, it isn't) - neither of these tutorials work. Leaving me again hanging in the air on how to use this stuff. :( Spent time on Google to find that most tutorials are very old and thus nothing at all what glade now is. The Gnome site doesn't have any tutorials. It's a shame because it would be nice to learn this.

Tutorial 1 (previously posted in this thread):
GTK+ and Glade3 GUI Programming Tutorial: http://www.micahcarrick.com/gtk-glade-t ... art-1.html
This one, I get as far as Adding Widgets to the GtkWindow and the menu editor and properties window, etc. is all totally different. I can't figure out how to get it to do what it wants. If I sent to normal, I can't set some of the properties as they are in the image version. And if I set those in image version and go back to normal, then the settings in the image part is lost. So I couldn't go any further in that tutorial. The tutorial is also very very old (2007)

Tutorial 2 (This tutorial was updated early 2014)
Again, some things were not the same (I had to find the 'destroy' in gtkWidgets as there was no gtkObject). Ok, once I got everything done I tried to run it and it won't run:

Code: Select all

ravenlx@solydk-devvm /media/sf_GTKTutorial $ ./tutorial-1.py

(tutorial-1.py:4648): GLib-GObject-ERROR **: cannot create instance of abstract (non-instantiatable) type 'GtkBox'
Trace/breakpoint trap
So again, I could not go any farther with the tutorial. Google didn't help because apparently what the tutorial was doing is deprecated.

Every other tutorial in the Google search results are several years old and outdated.

It makes it a nightmare trying to learn when you spend time only to get so far and find that there's an error that won't let you continue and no way to figure out what the problem is because you don't know anything about it.

The only glade in the repos is 3.14.2-3 but the python-glade is python-glade2 (v. 2.24.0-3+b1) and only libglade2-0. So it seems that this combination isn't going to work with any tutorials that are out there.

So how do I get started?


Return to “Code”

Who is online

Users browsing this forum: No registered users and 1 guest