LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-23-2003, 11:13 AM   #1
BongFish
Member
 
Registered: Jun 2003
Location: England
Distribution: Slack 9
Posts: 141

Rep: Reputation: 15
Need help with python!!


Hello people,
I've been learning Python as my first language but can't find two things in any of the tutorials:

1. How can you create GUI's for your programs? I want to be able to make programs which appear in an X window, for instance I'd like to make a little slide show program or something.

2. Is there an equivalent of a GOTO command like in DOS batch files? It would make life much easier in some situations, the only semi-equivalent seems to be the def function


Thanks a great deal, links to tutorials about the above things would be much appreciated.
 
Old 08-23-2003, 11:16 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
1. most toolkits have python bindings, e.g. pygtk for Gtk... go google

2. hahaha... don't use goto's... they are obscenely bad practise in the main...

Last edited by acid_kewpie; 08-23-2003 at 11:19 AM.
 
Old 08-23-2003, 11:24 AM   #3
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
1) Take a look at gtk
http://www.gtk.org

2)A good quick and dirty tutorial is here:
http://www.hetland.org/python/instant-hacking.php

Code:
    def hello(who):
        print "Hello,", who

    hello("world")
    # Prints out "Hello, world"
 
Old 08-23-2003, 11:32 AM   #4
BongFish
Member
 
Registered: Jun 2003
Location: England
Distribution: Slack 9
Posts: 141

Original Poster
Rep: Reputation: 15
Okay, GTK. Pardon my ignorance but GTK uses things called widgets doesn't it??

I'll take a look.


Why are goto's considered bad programing?
 
Old 08-23-2003, 01:22 PM   #5
Strike
Member
 
Registered: Jun 2001
Location: Houston, TX, USA
Distribution: Debian
Posts: 569

Rep: Reputation: 31
Quote:
Originally posted by david_ross

2)A good quick and dirty tutorial is here:
http://www.hetland.org/python/instant-hacking.php
Aha! That is where the EVIL and WRONG tutorial is. Thanks for the link so I can email the guy and tell him how EVIL and WRONG he is for using input() in a tutorial for newbies.

Lesson: quick and dirty, bad.
 
Old 08-23-2003, 01:25 PM   #6
Strike
Member
 
Registered: Jun 2001
Location: Houston, TX, USA
Distribution: Debian
Posts: 569

Rep: Reputation: 31
Quote:
Originally posted by BongFish
Okay, GTK. Pardon my ignorance but GTK uses things called widgets doesn't it??
Yes .... and? Every toolkit uses widgets of some sort. That's kind of what defines them as toolkits and not just drawing libs.

Quote:
Why are goto's considered bad programing?
If you really want to know, read Dijkstra's article. But the short and sweet version is this: it makes programs more complex than they need to be and it offers no advantages.
 
Old 08-23-2003, 01:38 PM   #7
BongFish
Member
 
Registered: Jun 2003
Location: England
Distribution: Slack 9
Posts: 141

Original Poster
Rep: Reputation: 15
LOL, I had no idea that all 'toolkits' used widgets or what they were.

I've downloaded pygtk, had a play around with it and looked through the example scripts.

Strike:- I guess I won't be using that guide then, it doesn't look very indepth anyway. I'm using the Python Tutorial for non-programmers from the python website at the moment, it's good so far.
 
Old 08-24-2003, 07:36 PM   #8
Odd_Bloke
Member
 
Registered: Aug 2003
Location: P'boro, UK
Distribution: Fedora Core 1 (Yarrow)
Posts: 87

Rep: Reputation: 15
Some good tutorials for teaching the basics are at the bottom of the page under the ones "For Younger" somethings, the Livewires tutorials. Sure, you may not be a kid, but they work.
 
Old 08-24-2003, 08:49 PM   #9
BongFish
Member
 
Registered: Jun 2003
Location: England
Distribution: Slack 9
Posts: 141

Original Poster
Rep: Reputation: 15
I'm 16 so I'll only feel slightly patronized reading thoes.

Cheers.

Last edited by BongFish; 08-25-2003 at 06:45 AM.
 
Old 08-25-2003, 10:05 AM   #10
Odd_Bloke
Member
 
Registered: Aug 2003
Location: P'boro, UK
Distribution: Fedora Core 1 (Yarrow)
Posts: 87

Rep: Reputation: 15
I'm 15 and I only feel patronised because I've done them all before and am now programming my own stuff (and helping write new sheets, my name is on Snake) using the libraries supplied.
 
Old 08-26-2003, 05:01 AM   #11
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729

Rep: Reputation: 32
Quote:
[

Strike:- I guess I won't be using that guide then, it doesn't look very indepth anyway. I'm using the Python Tutorial for non-programmers from the python website at the moment, it's good so far. [/B]
Bong Fish there is more than one tutorial there, which one are you using ??
 
Old 08-26-2003, 11:34 AM   #12
BongFish
Member
 
Registered: Jun 2003
Location: England
Distribution: Slack 9
Posts: 141

Original Poster
Rep: Reputation: 15
This one.
 
Old 08-26-2003, 02:21 PM   #13
davholla
Member
 
Registered: Jun 2003
Location: London
Distribution: Linux Mint 13 Maya
Posts: 729

Rep: Reputation: 32
thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Processing Conflict: python-devel conflicts python< 2.3.4-13.1 guarriman Fedora 2 04-23-2009 07:02 PM
installing python library's (Python Numeric) Four Linux - Newbie 1 10-16-2005 02:31 PM
Python guru's - Is this a python bug? or is it me? bardinjw Programming 2 06-23-2005 08:17 AM
WineX, python-gnome, and python-gtk DrD Fedora 0 08-03-2004 12:11 PM
install python 2.3 ,necssary to remove python 2.2 ngan_yine Linux - Newbie 7 12-28-2003 04:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration