本文整理汇总了Python中Message.show方法的典型用法代码示例。如果您正苦于以下问题:Python Message.show方法的具体用法?Python Message.show怎么用?Python Message.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message.show方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OutSign
# 需要导入模块: import Message [as 别名]
# 或者: from Message import show [as 别名]
class OutSign(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
#Setting the window title
self.setWindowTitle("Sign Out")
#Widget set up
self.searchTerm = QLineEdit("")
self.btnSearch = QPushButton("Search")
self.searchList = QListWidget()
self.btnBack = QPushButton("Back")
self.btnOut = QPushButton("Sign Out")
self.labelT = QLabel("Please enter your Surname:")
self.vLayoutMAIN = QVBoxLayout()
self.hLayout1 = QHBoxLayout()
self.hLayout2 = QHBoxLayout()
self.hLayout1.addWidget(self.searchTerm)
self.hLayout1.addWidget(self.btnSearch)
self.hLayout2.addWidget(self.btnBack)
self.hLayout2.addWidget(self.btnOut)
self.vLayoutMAIN.addWidget(self.labelT)
self.vLayoutMAIN.addLayout(self.hLayout1)
self.vLayoutMAIN.addWidget(self.searchList)
self.vLayoutMAIN.addLayout(self.hLayout2)
self.widget = QWidget()
self.widget.setLayout(self.vLayoutMAIN)
self.setCentralWidget(self.widget)
#Setting up push button connections
self.btnSearch.clicked.connect(self.btnSearch_pushed)
self.btnBack.clicked.connect(self.btnBack_pushed)
self.btnOut.clicked.connect(self.btnOut_pushed)
def btnSearch_pushed(self):
#Clearing the list
self.searchList.clear()
#Retrieving all visitors from the database
visitors = g_database.GetAllEntries()
#Converting the users entry to text
term = self.searchTerm.text()
#converting the term to lower to allow for user input error
term = term.lower()
termFound = False
for visitor in visitors:
#Obtaing the surname from the database
surname = visitor[2]
#converting the surname to lower to allow for user input error
surname = surname.lower()
#Checking the search term matches the term in the database and the visitor isnt signed out
if term == surname and visitor[7] == "N/A":
#Creating a full name
name = ""
#Adding the forename and a space to the string
name= name + (visitor[1]) + " "
#Adding a surname
name = name + (visitor[2])
#Adding the full name to the list
self.searchList.addItem(name)
termFound = True
#If the term isnt found
if termFound == False:
#Calling the error window, passing in the message to display
self.message=Message(self,"No entries found, please search again")
#Showing the window
self.message.show()
#Raising the window the front of the screen
self.message.raise_()
#Returning the to the parent window
def btnBack_pushed(self):
self.parent.show()
self.parent.raise_()
self.close()
def btnOut_pushed(self):
#Converting the users selected item to text
currentItem = self.searchList.currentItem().text()
#Calling the clarification window, passing in the users selected name
self.clarification = Clarification(self,currentItem)
self.clarification.show()
self.clarification.raise_()
self.close()
示例2: VisitorBook
# 需要导入模块: import Message [as 别名]
# 或者: from Message import show [as 别名]
#.........这里部分代码省略.........
#Setting the row count to the number of entries so that there are no empty rows
self.table.setRowCount(len(entries))
#Setting the coloumn count to 8
self.table.setColumnCount(8)
#Setting the header labels
self.table.setHorizontalHeaderLabels(["ID","Forename","Surname","Reg","Visiting","Date","Time In","Time Out"])
row = -1
#Sorting through each entry
for entry in entries:
column = 0
row += 1
#Sorting through each field in each entry
for field in entry:
#Adding each field to the table
self.table.setItem(row,column,QTableWidgetItem(str(field)))
column += 1
def btnSearchPushed(self):
#Clearing the table
self.table.clear()
#Converting the users input to text
term = self.searchTerm.text()
#converting the term to lower case to allow for user input error
term = term.lower()
#Checking if the user actually entered something
if term == "":
#Running the 'refreshTable' function
self.refreshTable()
else:
#Retrieving all visitor entries from the database
entries = g_database.GetAllEntries()
RowCount = 0
#Setting the row count
self.table.setRowCount(RowCount)
#Setting the coloumn count
self.table.setColumnCount(8)
#Setting the table headers
self.table.setHorizontalHeaderLabels(["ID","Forename","Surname","Reg","Visiting","Date","Time In","Time Out"])
row = -1
#Sorting through each entry in the database
#Setting the variable to True
table_empty =True
for entry in entries:
#Obtaining the forename from the database
forename = entry[1]
#converting the forename to lower case to allow for user input error
forename=forename.lower()
#Obtaining the surname from the database
surname = entry[2]
#converting the surname to lower case to allow for user input error
surname = surname.lower()
#Converting the id intger to a string so it can be compared to the term, as the term is text
ID = str(entry[0])
#Obtaining the registration number from the database
reg = entry[3]
#converting the registration number to lower case to allow for user input error
reg = reg.lower()
##Obtaining the employee being visited from the database
visiting = entry[4]
#converting visiting to lower case to allow for user input error
visiting = visiting.lower()
#Checking to see if the term matches any of the fields in the database
if term == ID or term == forename or term == surname or term == reg or term == visiting or term == entry[5] or term == entry[6] or term == entry[7]:
RowCount +=1
#Resetting the row count to allow the program to add the found visitor
self.table.setRowCount(RowCount)
column = 0
row += 1
#Sorting through each field in that entry
for field in entry:
#Adding the field to the table
self.table.setItem(row,column,QTableWidgetItem(str(field)))
column += 1
#Changing table_empty to False if an entry has been entered into the table
table_empty = False
if table_empty == True:
#Calling the message window, passing in the message to display
self.error = Message(self,"No entries found, please try again")
self.error.show()
self.error.raise_()
self.refreshTable()
#Returning to the parent window
def btnBackPushed(self):
self.parent.show()
self.parent.raise_()
self.close()
def btnClearPushed(self):
#Calling the clarification window
self.clear = Clarification(self)
#Showing the window
self.clear.show()
#Raising the window to the front of the screen
self.clear.raise_()
#Closing the current window
self.close()
示例3: Game
# 需要导入模块: import Message [as 别名]
# 或者: from Message import show [as 别名]
class Game(pyglet.window.Window):
def __init__(self):
super(Game, self).__init__()
self.map = Map(data)
self.pathfinding = AStar(self.map)
pyglet.clock.schedule_interval(self.update, 1/120.0)
self.pause = False
self.message = Message(["Well hello there, you sexy beast. This is long text...", "You bastard"]);
self.player = Player(self, self.map.grid[2,1], 0, 0)
self.npc = NPC(self, self.map.grid[2,1], self.map.get_tile(7,5))
self.player.create_animations()
self.npc.create_animations()
self.enemy = Enemy(self, self.map.grid[2,1], self.map.get_tile(1,5))
self.enemy.create_animations()
#little hack to get the viewport centered and then to follow the player
temp_size = self.get_size()
self.viewport_x = temp_size[0]/2
self.viewport_y = 0
self.offset_x = 0
self.offset_y = 0
self.update_viewport(temp_size[0]/2, 0)
self.viewport_y = temp_size[1]/2
def update(self, dt):
self.clear()
self.map.draw()
self.player.draw()
self.enemy.draw()
self.npc.draw()
self.player.inventory.update(self.offset_x, self.offset_y)
if not self.message.finished:
self.pause = True
self.message.show()
else:
self.pause = False
if self.pause:
return
self.player.update(dt)
if self.enemy.is_alive():
if not self.enemy.tasks.has_tasks():
self.enemy.calculate_next_move()
if self.enemy.next_move != self.enemy.tile:
self.enemy.tasks.add_task(self.enemy.next_move, TASK_WALK)
self.enemy.update(dt)
def update_viewport(self, x = -1, y = -1):
x_pos, y_pos = x, y
if x == -1:
x_pos = -self.player.x + self.viewport_x
if y == -1:
y_pos = -self.player.y + self.viewport_y
self.offset_x = x_pos
self.offset_y = y_pos
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glTranslatef(x_pos, y_pos, 1.0)
glPushMatrix()
glPopMatrix()
def on_mouse_press(self, x, y, button, modifiers):
x_pos = x - self.offset_x
y_pos = y - self.offset_y
if button == LEFT_CLICK:
if self.message:
self.message.next()
if self.pause:
return
if button == RIGHT_CLICK:
for tile in self.map.tiles:
if(tile.contains(tile.image, x_pos, y_pos) == True):
if tile.is_passable():
move_loc = tile.get_move_loc()
tasks = self.pathfinding.calcShortest(self.map.get_tile(self.player.grid_x, self.player.grid_y), self.map.get_tile(move_loc[0], move_loc[1]))
if tasks:
if len(tasks) > 1:
self.player.tasks.clear_tasks()
tasks.reverse()
tasks.pop(0)
index = len(tasks) - 1
for task in tasks:
self.player.tasks.add_task(task, TASK_WALK)
if type(tasks[index].person) == NPC:
action = self.player.tasks.add_task(tasks[index].person, TASK_SPEAK)
if type(tasks[index].person) == Enemy:
tasks[index].person.under_attack = True
self.player.tasks = TaskQueue()
self.player.tasks.add_task(tasks[index].person, TASK_GOTO)
print "Task Attack"
self.player.tasks.add_task(tasks[index].person, TASK_ATTACK)
#.........这里部分代码省略.........
示例4: InSign
# 需要导入模块: import Message [as 别名]
# 或者: from Message import show [as 别名]
#.........这里部分代码省略.........
surname = self.surname.text()
registration = self.reg.text()
forename_valid = True
surname_valid = True
reg_valid = False
#Checking if the line edit has been left blank
if forename != "" and surname != "" and registration != "":
#Converting the forename and surname to lower case for easier validation
forename = forename.lower()
surname = surname.lower()
#Setting up blank lists to append the alphabet into
alphabet = ['-']
#Creating the alphabet from ascii characters
for letter in map(chr, range(97, 123)):
#Adding the character to the blank list
alphabet.append(letter)
count = -1
#Sorting through each character in 'forename'
for each in forename:
#Checking to see if its in the alphabet
if each not in alphabet:
forename_valid = False
#Sorting through each character in 'surname'
for each in surname:
#Checking to see if its in the alphabet
if each not in alphabet:
surname_valid = False
if forename_valid == False:
#Calling the message window, passing in the message to display
self.error = Message(self,"Please enter a valid Forename")
#Showing the window
self.error.show()
#Raising the window the front of the screen
self.error.raise_()
if surname_valid == False:
#Calling the message window, passing in the message to display
self.error = Message(self,"Please enter a valid Surname")
#Showing the window
self.error.show()
#Raising the window the front of the screen
self.error.raise_()
#Making the initial upper case
initial = forename[0].upper()
count = 1
#Adding the rest of the 'forename' to the new string
for each in range(len(forename)-1):
initial= initial + forename[count]
count +=1
forename = initial
#Making the initial upper case
initial = surname[0].upper()
count = 1
#Adding the rest of the 'forename' to the new string
for each in range(len(surname)-1):
initial= initial + surname[count]
count +=1
surname = initial
#Converting all of registration to upper case to format it correctly
registration= registration.upper()
#Checking that the registration number is less than or equal to 7
if len(registration) <= 7:
示例5: addEmployee
# 需要导入模块: import Message [as 别名]
# 或者: from Message import show [as 别名]
class addEmployee(QMainWindow):
def __init__(self,parent):
super().__init__()
self.parent = parent
#Setting the window title
self.setWindowTitle("Add employee")
#Widget set up
self.forename = QLineEdit()
self.labelF = QLabel("Forename: ")
self.surname = QLineEdit()
self.labelS = QLabel("Surname: ")
self.btnAdd = QPushButton("Add")
self.btnCancel = QPushButton("Cancel")
self.labelD = QLabel("Department:")
self.department = QComboBox()
#Adding the departments
self.department.addItem("Marketing")
self.department.addItem("Production")
self.department.addItem("Sales")
self.department.addItem("R&D")
self.VLayoutMAIN = QVBoxLayout()
self.VLayout1 = QVBoxLayout()
self.VLayout2 = QVBoxLayout()
self.HLayout1 = QHBoxLayout()
self.HLayout2 = QHBoxLayout()
self.VLayout1.addWidget(self.labelF)
self.VLayout1.addWidget(self.labelS)
self.VLayout1.addWidget(self.labelD)
self.VLayout2.addWidget(self.forename)
self.VLayout2.addWidget(self.surname)
self.VLayout2.addWidget(self.department)
self.HLayout1.addLayout(self.VLayout1)
self.HLayout1.addLayout(self.VLayout2)
self.HLayout2.addWidget(self.btnCancel)
self.HLayout2.addWidget(self.btnAdd)
self.VLayoutMAIN.addLayout(self.HLayout1)
self.VLayoutMAIN.addLayout(self.HLayout2)
self.widget = QWidget()
self.widget.setLayout(self.VLayoutMAIN)
self.setCentralWidget(self.widget)
#Setting up button connections, to run functions when the buttons are pushed
self.btnAdd.clicked.connect(self.btnAdd_pushed)
self.btnCancel.clicked.connect(self.btnCancel_pushed)
def btnAdd_pushed(self):
#Converting the entries to text
forename = self.forename.text()
surname = self.surname.text()
#Obtaining the selected index
index = self.department.currentIndex()
if index == 0:
department = "Marketing"
elif index == 1:
department = "Production"
elif index == 2:
department = "Sales"
elif index == 3:
department = "R&D"
forename_valid = True
surname_valid = True
#Checking if the line edit has been left blank
if forename != "" and surname != "":
#Converting the forename and surname to lower case for easier validation
forename = forename.lower()
surname = surname.lower()
#Setting up blank lists to append the alphabet into
alphabet = ['-']
#Creating the alphabet from ascii characters
for letter in map(chr, range(97, 123)):
#Adding the character to the blank list
alphabet.append(letter)
count = -1
#Sorting through each character in 'forename'
for each in forename:
#Checking to see if its in the alphabet
if each not in alphabet:
forename_valid = False
#Sorting through each character in 'surname'
for each in surname:
#Checking to see if its in the alphabet
if each not in alphabet:
surname_valid = False
if forename_valid == False:
#Calling the message window, passing in the message to display
self.error = Message(self,"Please enter a valid Forename")
#Showing the window
self.error.show()
#Raising the window the front of the screen
self.error.raise_()
if surname_valid == False:
#Calling the message window, passing in the message to display
self.error = Message(self,"Please enter a valid Surname")
#Showing the window
self.error.show()
#.........这里部分代码省略.........