tchristensen
Emperor
Oh man, that sucks.
Again, thanks for all your help. It is not forgotten!
Again, thanks for all your help. It is not forgotten!
Sure, but I'm guessing you never read the tutorial then? Because there is no reason to fumble around at random, especially if you have several hours to to spare.I am struggling with getting that boxed centered in the main screen. I have tried for the last couple of hours, mostly guessing on this.
How about another clue?
So the PyPopup.setPosition() method is no different than the PyPopup.setHeaderString() and the PyPopup.setBodyString() methods. So you do the same thing, just add one line of code but replace the method with another.These are two examples of method invocation.Code:modPopup.setHeaderString("Tutorial") modPopup.setBodyString("This is a Python tutorial.\n\nby Baldyr")
The PyPopup instance we're referencing with the modPopup variable has "methods" defined in its class, and we call on them with dot notation. This is a common practice in both regular and CivIV Python, and it entails putting an object (like an instance of a class - like PyPopup) first, followed by a dot, and lastly we add the method name. (In this case the names pretty much tell what they will do for the Popup.) Inside the parenthesis you put parameters, and in this case these are string values.
import Rebels
Rebels.showPopup()
You thought wrong, but that is OK it's often hard to teach someone something new without assuming they aren't trying.
I followed through the tutorial many times, changing what I think should be done, but either the window looked the same or it never spawned.
It is probably very easy, but I just don't know the syntax. It would be cool to have the window centered but I guess where it is at is OK.
This is one of the lines I tried to add, to no avail:
"""Displays the welcome message on game start"""
modPopup = PyPopup()
modPopup.setPosition(self, i50, i200)
modPopup.setHeaderString(popupHeader)
modPopup.setBodyString(popupMessage)
modPopup.launch()
Edit -- Actually I didn't realize I could do that. Fantastic! I was getting tired of reloading the game over, and over, and over, and over. . . .
; Set to 1 for no python exception popups
HidePythonExceptions = 1
; Set to 1 for no python exception popups
HidePythonExceptions = [B]0[/B]
modPopup.setPosition(50, 200)
The way to center it is probably to first find a method for setting the size of the popup, which you would find in the Popup module. (I haven't checked, but I'm rather assuming this.)I hope to add code to center it on any screen resolution, but may just settle for it to be somewhere around the center of the screen.
iXCoord = (iScreenWidth - iPopupWidth) / 2
Good for you! Otherwise the textbook I was referring to is also available in PDF if you wanna print it out - or as an actual textbook for purchase online (I believe). But any textbook should be able to teach you the basics - because thats what you need.Edit: Went to the library today and picking up some simple Python textbooks (I am old school I guess in that I like a book to study from rather than all the online stuff; yeah I know its weird).
Does anyone know if Civ V uses python as well, or is there a different method of modding?