Active Topics

 


Reply
Thread Tools
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#41
wow.... indents ... evil things!!!

Figured out the code i need, but using wordpad..... keeps giving me indent errors! lol!
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#42
beaten for 5 minutes, but not out!!!

Now i have a program that has an input field, and a button. You press the button and it has a popup message as follows!

__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 

The Following User Says Thank You to noobmonkey For This Useful Post:
Posts: 3,428 | Thanked: 2,856 times | Joined on Jul 2008
#43
Originally Posted by noobmonkey View Post
wow.... indents ... evil things!!!

Figured out the code i need, but using wordpad..... keeps giving me indent errors! lol!
Yes. This one thing that annoys me about Python. It's not so much the indenting, I do like structure, but there is no "end" tag.

I really prefer ruby for that. Python can get.. so ugly.
__________________
If I've helped you or you use any of my packages feel free to help me out.
-----------------------------------------------------------------------------------
Maintaining:
pyRadio - Pandora Radio on your N900, N810 or N800!
 

The Following User Says Thank You to fatalsaint For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#44
keep forgetting it's open source - and someone (Tex?) may want to have a look?
Code:
import PyQt4
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore



class HelloWindow(QtGui.QMainWindow):

	def __init__(self, win_parent = None):
		#Init the base class
		QtGui.QMainWindow.__init__(self, win_parent)
		self.create_widgets()


	def create_widgets(self):
		#Widgets
		self.label = QtGui.QLabel("Say hello:")
		self.hello_edit = QtGui.QLineEdit()
		self.hello_button = QtGui.QPushButton("Push Me!")

		#connect signal
		QtCore.QObject.connect(self.hello_button
			, QtCore.SIGNAL("clicked()")
			, self.on_hello_clicked)


		#Horizontal layout
		h_box = QtGui.QHBoxLayout()
		h_box.addWidget(self.label)
		h_box.addWidget(self.hello_edit)
		h_box.addWidget(self.hello_button)
		#Create central widget, add layout and set
		central_widget = QtGui.QWidget()
		central_widget.setLayout(h_box)
		self.setCentralWidget(central_widget)

	def on_hello_clicked(self):
		QtGui.QMessageBox.information(self
			, "Hello!"
			, "Hello %s" % self.hello_edit.displayText()
			, QtGui.QMessageBox.Ok)

if __name__ == "__main__":
	# Someone is launching this directly
	# Create the QApplication
	app = QtGui.QApplication(sys.argv)
	#The Main window
	main_window = HelloWindow()
	main_window.show()
	# Enter the main loop
	app.exec_()
this is my py file - i think my first steps have to be learning the layout of python, even before the code - seems simple enough at the moment though....
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 

The Following User Says Thank You to noobmonkey For This Useful Post:
Posts: 3,319 | Thanked: 5,610 times | Joined on Aug 2008 @ Finland
#45
Originally Posted by Texrat View Post
"Could not open lock file /var/lib/dpkg/lock - open (13 permission denied) yadda yadda yadda... are you root?"

Hey, see post #2, you're overdoing it. Just install python2.5-qt4-doc from the application manager, no root/console funk needed.

The apt-get way of installing a basic PyQt is (sort of) officially deprecated, as then you would have to just through the same hoops to uninstall it. it's much cleaner to do via the App Manager.

PS. And if you don't happen see python2.5-qt4-doc/PyQt in the application manager, blame Extras testing procedures and wait ~24 hours (we're day 9 of the 10 day quarantine period).
__________________
Blogging about mobile linux - The Penguin Moves!
Maintainer of PyQt (see introduction and docs), AppWatch, QuickBrownFox, etc
 

The Following 2 Users Say Thank You to attila77 For This Useful Post:
Posts: 3,428 | Thanked: 2,856 times | Joined on Jul 2008
#46
Originally Posted by attila77 View Post
Hey, see post #2, you're overdoing it. Just install python2.5-qt4-doc from the application manager, no root/console funk needed.

The apt-get way of installing a basic PyQt is (sort of) officially deprecated, as then you would have to just through the same hoops to uninstall it. it's much cleaner to do via the App Manager.

PS. And if you don't happen see python2.5-qt4-doc/PyQt in the application manager, blame Extras testing procedures and wait ~24 hours (we're day 9 of the 10 day quarantine period).
How many of python's bindings does that depend on? If all you need is qt4-gui why get all the rest? Waste of space. IMHO.
__________________
If I've helped you or you use any of my packages feel free to help me out.
-----------------------------------------------------------------------------------
Maintaining:
pyRadio - Pandora Radio on your N900, N810 or N800!
 
Texrat's Avatar
Posts: 11,700 | Thanked: 10,045 times | Joined on Jun 2006 @ North Texas, USA
#47
Thanks attila, and no, I didn't see python2.5-qt4-doc/PyQt in app manager. But I downloaded the bulk package earlier. Maybe that's why I got the error?
__________________
Nokia Developer Champion
Different <> Wrong | Listen - Judgment = Progress | People + Trust = Success
My personal site: http://texrat.net
 
Texrat's Avatar
Posts: 11,700 | Thanked: 10,045 times | Joined on Jun 2006 @ North Texas, USA
#48
Originally Posted by noobmonkey View Post
this is my py file - i think my first steps have to be learning the layout of python, even before the code - seems simple enough at the moment though....
What I like about Python is that it's so intuitive for a VB.Net programmer. I read through my books and everything makes quick and easy sense. Object orientation for the win!
__________________
Nokia Developer Champion
Different <> Wrong | Listen - Judgment = Progress | People + Trust = Success
My personal site: http://texrat.net
 

The Following User Says Thank You to Texrat For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#49
Originally Posted by Texrat View Post
What I like about Python is that it's so intuitive for a VB.Net programmer. I read through my books and everything makes quick and easy sense. Object orientation for the win!
hehe - well kinda, OOP has allways been my nemesis, and i struggled a bit to begin with in .net, but i suppose that patience is paying of for this patience

this does feel a bit more like home for me. Tried the madde approach, and just couldnt figure it out. And the hello world, + installs took me 15 minutes in this example!
and an extra 20 to get extra buttons etc....

I think over the next few weeks i'll start playing with all the widgets before i kick off trying to make a proper application (Allthough i wonder how many hellow worlds we could fit in the repositories?!) hehe
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
Posts: 3,319 | Thanked: 5,610 times | Joined on Aug 2008 @ Finland
#50
Originally Posted by fatalsaint View Post
How many of python's bindings does that depend on? If all you need is qt4-gui why get all the rest? Waste of space. IMHO.
Please, let's not confuse people.

I intentionally threw out a lot of dependencies of that package so they could start off with a reasonable minimum. That means Core, GUI, XML and Help. Core and XML are IIRC part of PR1.1. GUI is needed anyway. Help is maybe an overkill as not many would have Qt Docs on the N900 anyway, and you are free to improve on the demo app inherited from upstream to rid it of the QtHelp dependency (as Nokians say, patches welcome ).

The *advantages* of going through the app manager instead of apt-getting IMHO outweigh the 10 megs of optified space you save:
  • You get automatic updates
  • You can uninstall cleanly without potential sideeffects
  • No need for root user and console operations
  • You get about 50 examples of various Qt classes implemented in a Qt App
  • You get html documentation of the Python implementation of Qt classes
  • You get a demo app, which shows the examples from above in a user-friendly manner, again, no console-mongering needed

Now, if you KNOW what you need PyQt for and need no examples, no Maemo integration, updates, whatever, you are, of course, free to install through apt-get, but that is not the point of this thread (how to START developing in Python and Qt).
__________________
Blogging about mobile linux - The Penguin Moves!
Maintainer of PyQt (see introduction and docs), AppWatch, QuickBrownFox, etc
 

The Following 3 Users Say Thank You to attila77 For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 17:50.