- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
所以有一个用户登录的第一个窗口。用户登录后,他们可以通过单击“继续”按钮开始游戏。此按钮的命令设置为应该使用 window.destroy() 函数关闭窗口的函数 con,但是每当我尝试单击它时,我总是收到一条错误消息,指出“窗口未定义”
import sqlite3
from tkinter import ttk
import tkinter
from tkinter import messagebox
#SQL DATABASES~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def SQLQuestion():
with sqlite3.connect("games.db") as db:
cursor = db.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS game (
questionID integer PRIMARY KEY AUTOINCREMENT,
question text,
answer text
)""")
def SQLUser():
with sqlite3.connect("User.db") as db:
cursor = db.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS user (
userID INTEGER PRIMARY KEY,
username VARCHAR(20) NOT NULL,
password VARCHAR(20) NOT NULL,
userscore INTEGER,
usertime REAL
)""")
#SQL USER LOG IN/CREATE/DELETE ACCOUNT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def login(usernameLogin, passwordLogin):
while True:
username = usernameLogin.get()#Asks for username
password = passwordLogin.get()#Asks for password
with sqlite3.connect("User.db") as db:#Creates a connection to database
c = db.cursor()
find_user = ("SELECT * FROM user WHERE username = ? AND password = ?")#Validates inputs for account
c.execute(find_user,[(username),(password)])
results = c.fetchall()#Fetches values from database
if results:#Validates if the username/password is recognised
for i in results:
messagebox.showinfo("", "Welcome "+i[1]+"!")
QuestionMenu()
break
else:
messagebox.showinfo("", "Password and username is not recognised")
break
window.destroy()
def newUser(username1, password1):
found = 0
while found == 0:
username = username1.get()
with sqlite3.connect("User.db") as db:
c = db.cursor()
findUser = ("SELECT * FROM user WHERE username = ?")
c.execute(findUser, [(username)])#Checks existence of username in database
if c.fetchall():
messagebox.showinfo("Username", "Username taken please try again.")
break
else:
messagebox.showinfo("", "Account has been created!")
found = 1
password = password1.get()
insertData = '''INSERT INTO user(username, password)
VALUES(?,?)'''#Inserts new account into databse
c.execute(insertData, [(username),(password)])
db.commit()
def newUserTkinter():
window = tkinter.Tk()
window.title("Create new account")
labelOne = ttk.Label(window, text = "Enter a username:")
labelOne.grid(row = 0, column = 0)
username1 = tkinter.StringVar(window)#value type is classified as a string
usernameEntry = ttk.Entry(window, width = 30, textvariable = username1)
usernameEntry.grid(row = 1, column = 0)
labelTwo = ttk.Label(window, text = "Enter a password:")
labelTwo.grid(row = 2, column = 0)
password1 = tkinter.StringVar(window)#value type is classified as a string
passwordEntry = ttk.Entry(window, width = 30, textvariable = password1)
passwordEntry.grid(row = 3, column = 0)
btn = ttk.Button(window, text="Submit", command=lambda: newUser(username1, password1))
btn.grid(row = 3, column = 1)
def removeUser(usernameD, passwordD):
exists = 0
while exists == 0:#Validates exsistence of account username
username = usernameD.get()
password = passwordD.get()
with sqlite3.connect("User.db") as db:
c = db.cursor()
findUser = ("SELECT * FROM user WHERE username = ?")
c.execute(findUser, [(username)])
if c.fetchall():
messagebox.showinfo("Delete account", "Account deleted!")
exists = 1
else:
messagebox.showinfo("", "Account does not exist")
break
remove_user = ("DELETE from user WHERE username = ? AND password = ?")
c.execute(remove_user,[(username),(password)])
db.commit()
def removeUserTkinter():
window = tkinter.Tk()
window.title("Delete account")
labelOne = ttk.Label(window, text = "Enter account username:")
labelOne.grid(row = 0, column = 0)
usernameD = tkinter.StringVar(window)#value type is classified as a string
usernameEntry = ttk.Entry(window, width = 30, textvariable = usernameD)
usernameEntry.grid(row = 1, column = 0)
labelTwo = ttk.Label(window, text = "Enter account password:")
labelTwo.grid(row = 2, column = 0)
passwordD = tkinter.StringVar(window)#value type is classified as a string
passwordEntry = ttk.Entry(window, width = 30, textvariable = passwordD)
passwordEntry.grid(row = 3, column = 0)
btn = ttk.Button(window, text="Submit", command=lambda: removeUser(usernameD, passwordD))
btn.grid(row = 3, column = 1)
def menu():
with sqlite3.connect("User.db") as db:
c = db.cursor()
c.execute("SELECT * FROM user")
print(c.fetchall())
window = tkinter.Tk()
window.title("Treasure Hunt Game!")
labelOne = ttk.Label(window, text = """ ~~~~~~~~~~~~~ USER MENU ~~~~~~~~~~~~~
""")#label displays instruction
labelOne.grid(row = 0, column = 0)#places label in a grid
btn = ttk.Button(window, text = "Create account", command = newUserTkinter)
btn.grid(row = 1, column = 0)#places button in a grid
btn = ttk.Button(window, text = "Delete account", command = removeUserTkinter)
btn.grid(row = 2, column = 0)#places button in a grid
labelTwo = ttk.Label(window, text = "Login to your account:")
labelTwo.grid(row = 3, column = 0)
usernameLogin = tkinter.StringVar(window)#value type is classified as a string
usernameEntry = ttk.Entry(window, width = 30, textvariable = usernameLogin)
usernameEntry.grid(row = 5, column = 0)
labelTwo = ttk.Label(window, text = "Username")
labelTwo.grid(row = 4, column = 0)
passwordLogin = tkinter.StringVar(window)#value type is classified as a string
passwordEntry = ttk.Entry(window, width = 30, textvariable = passwordLogin)
passwordEntry.grid(row = 7, column = 0)
labelTwo = ttk.Label(window, text = "Password")
labelTwo.grid(row = 6, column = 0)
btn = ttk.Button(window, text="Log in", command=lambda: login(usernameLogin, passwordLogin))
btn.grid(row = 7, column = 1)
#SQL QUESTION ADD/REMOVE/GET~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def insert_question(emp):
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("INSERT INTO game VALUES (?, ?, ?)", (emp))
conn.commit()
def get_question():
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("SELECT * FROM game")
return c.fetchall()
def get_number_total_question(): #Get the total number of question
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("SELECT COUNT(*) FROM game")
return c.fetchone()[0]
def get_single_question(question_number): #Get a question from the database
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("SELECT question FROM game WHERE questionID="+str(question_number))
return c.fetchone()[0]
def get_answer(question_number): #Get the answer from the database
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("SELECT answer FROM game WHERE questionID="+str(question_number))
return c.fetchone()[0]
def remove_question(emp):
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("DELETE from game WHERE question = ?", [emp])
conn.commit()
#Tkinter~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def showInstructions():
messagebox.showinfo("Instructions", """You are a treasure hunter, your goal is to collect atleast 100
gold by the end of the game from treasure chests randomly scattered across the grid.There are 10 chests within a grid and
each treasure chest is worth 10 gold but can only be reclaimed 3 times before it is replaced by a bandit.
Landing on a bandit will cause you to lose all of your
gold and if all the chests have been replaced by bandits and you have less then 100 gold this means you lose!
Press enter to continue...""")#messagebox used for more simple functions (showing messages)
def showLeaderboard():
messagebox.showinfo("Leaderboard", "shows leaderboard")
def con():
messagebox.showinfo("Game", "Time to play!")
window.destroy()
def showQuestions():
emps = get_question()
messagebox.showinfo("List of questions/answers", emps)
def AddQuestion(mathquestion, mathanswer):
mathquestion1 = mathquestion.get()
mathanswer1 = mathanswer.get()
emp_1 = (None, mathquestion1, mathanswer1)
insert_question(emp_1)
messagebox.showinfo("Question inputed!")
emps = get_question()
print(emps)
def removeQuestion(DeleteQuestion):
exists = 0
while exists == 0:#Validates exsistence of question
DeleteQuestion1 = DeleteQuestion.get()
conn = sqlite3.connect('games.db')
c = conn.cursor()
findQuestion = ("SELECT * FROM game WHERE question = ?")
c.execute(findQuestion, [(DeleteQuestion1)])
if c.fetchall():
messagebox.showinfo("Delete qustion","Question deleted!")
exists = 1
else:
messagebox.showinfo("","Question does not exist")
break
remove_question(DeleteQuestion1)
def removeQuestionTk():
window = tkinter.Tk()
window.title("Remove a question.")
labelOne = ttk.Label(window, text = "Enter question to remove:")
labelOne.grid(row = 0, column = 0)
DeleteQuestion = tkinter.StringVar(window)#value type is classified as a string
questionEntry = ttk.Entry(window, width = 30, textvariable = DeleteQuestion)
questionEntry.grid(row = 1, column = 0)
btn = ttk.Button(window, text="Submit", command=lambda: removeQuestion(DeleteQuestion))
btn.grid(row = 1, column = 1)
def QuestionMenu():
with sqlite3.connect("games.db") as db:
c = db.cursor()
window = tkinter.Tk()
window.title("Treasure Hunt Game!")
labelOne = ttk.Label(window, text = """ ~~~~~~~~~~~~~ GAME MENU ~~~~~~~~~~~~~
""")#label displays instruction
labelOne.grid(row = 0, column = 0)#places label in a grid
btn = ttk.Button(window, text = "View instructions", command = showInstructions)
btn.grid(row = 1, column = 0)#places button in a grid
btn = ttk.Button(window, text = "View leaderboard", command = showLeaderboard)
btn.grid(row = 2, column = 0)
btn = ttk.Button(window, text = "View all questions", command = showQuestions)
btn.grid(row = 3, column = 0)
btn = ttk.Button(window, text = "Continue", command = con)
btn.grid(row = 4, column = 0)
labelTwo = ttk.Label(window, text = "Enter a math question:")
labelTwo.grid(row = 5, column = 0)
mathquestion = tkinter.StringVar()#value type is classified as a string
userEntryQ = ttk.Entry(window, width = 30, textvariable = mathquestion)
userEntryQ.grid(row = 6, column = 0)
labelTwo = ttk.Label(window, text = "Enter the answer to this question:")
labelTwo.grid(row = 7, column = 0)
mathanswer = tkinter.StringVar()
userEntryQ = ttk.Entry(window, width = 30, textvariable = mathanswer)
userEntryQ.grid(row = 8, column = 0)
btn = ttk.Button(window, text = "Submit", command=lambda: AddQuestion(mathquestion, mathanswer))
btn.grid(row = 8, column = 1)
btn = ttk.Button(window, text = "Remove a question", command = removeQuestionTk)
btn.grid(row = 9, column = 0)#places button in a grid
SQLUser()
SQLQuestion()
menu()
最佳答案
这将与登录按钮一起使用,,,, 我发送了带有登录功能的窗口
这里我给函数添加了窗口
def login(usernameLogin, passwordLogin,btn):
.在“btn.destroy()”中我关闭了窗口
if results:#Validates if the username/password is recognised
for i in results:
messagebox.showinfo("", "Welcome "+i[1]+"!")
btn.destroy()
QuestionMenu()
.在这里,我将窗口发送给函数。
btn = ttk.Button(window, text="Log in", command=lambda: login(usernameLogin, passwordLogin,window))
.
import sqlite3
from tkinter import ttk
import tkinter
from tkinter import messagebox
#SQL DATABASES~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def SQLQuestion():
with sqlite3.connect("games.db") as db:
cursor = db.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS game (
questionID integer PRIMARY KEY AUTOINCREMENT,
question text,
answer text
)""")
def SQLUser():
with sqlite3.connect("User.db") as db:
cursor = db.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS user (
userID INTEGER PRIMARY KEY,
username VARCHAR(20) NOT NULL,
password VARCHAR(20) NOT NULL,
userscore INTEGER,
usertime REAL
)""")
#SQL USER LOG IN/CREATE/DELETE ACCOUNT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def login(usernameLogin, passwordLogin,btn):
while True:
username = usernameLogin.get()#Asks for username
password = passwordLogin.get()#Asks for password
with sqlite3.connect("User.db") as db:#Creates a connection to database
c = db.cursor()
find_user = ("SELECT * FROM user WHERE username = ? AND password = ?")#Validates inputs for account
c.execute(find_user,[(username),(password)])
results = c.fetchall()#Fetches values from database
if results:#Validates if the username/password is recognised
for i in results:
messagebox.showinfo("", "Welcome "+i[1]+"!")
btn.destroy()
QuestionMenu()
break
else:
messagebox.showinfo("", "Password and username is not recognised")
break
window.destroy()
def newUser(username1, password1):
found = 0
while found == 0:
username = username1.get()
with sqlite3.connect("User.db") as db:
c = db.cursor()
findUser = ("SELECT * FROM user WHERE username = ?")
c.execute(findUser, [(username)])#Checks existence of username in database
if c.fetchall():
messagebox.showinfo("Username", "Username taken please try again.")
break
else:
messagebox.showinfo("", "Account has been created!")
found = 1
password = password1.get()
insertData = '''INSERT INTO user(username, password)
VALUES(?,?)'''#Inserts new account into databse
c.execute(insertData, [(username),(password)])
db.commit()
def newUserTkinter():
window = tkinter.Tk()
window.title("Create new account")
labelOne = ttk.Label(window, text = "Enter a username:")
labelOne.grid(row = 0, column = 0)
username1 = tkinter.StringVar(window)#value type is classified as a string
usernameEntry = ttk.Entry(window, width = 30, textvariable = username1)
usernameEntry.grid(row = 1, column = 0)
labelTwo = ttk.Label(window, text = "Enter a password:")
labelTwo.grid(row = 2, column = 0)
password1 = tkinter.StringVar(window)#value type is classified as a string
passwordEntry = ttk.Entry(window, width = 30, textvariable = password1)
passwordEntry.grid(row = 3, column = 0)
btn = ttk.Button(window, text="Submit", command=lambda: newUser(username1, password1))
btn.grid(row = 3, column = 1)
def removeUser(usernameD, passwordD):
exists = 0
while exists == 0:#Validates exsistence of account username
username = usernameD.get()
password = passwordD.get()
with sqlite3.connect("User.db") as db:
c = db.cursor()
findUser = ("SELECT * FROM user WHERE username = ?")
c.execute(findUser, [(username)])
if c.fetchall():
messagebox.showinfo("Delete account", "Account deleted!")
exists = 1
else:
messagebox.showinfo("", "Account does not exist")
break
remove_user = ("DELETE from user WHERE username = ? AND password = ?")
c.execute(remove_user,[(username),(password)])
db.commit()
def removeUserTkinter():
window = tkinter.Tk()
window.title("Delete account")
labelOne = ttk.Label(window, text = "Enter account username:")
labelOne.grid(row = 0, column = 0)
usernameD = tkinter.StringVar(window)#value type is classified as a string
usernameEntry = ttk.Entry(window, width = 30, textvariable = usernameD)
usernameEntry.grid(row = 1, column = 0)
labelTwo = ttk.Label(window, text = "Enter account password:")
labelTwo.grid(row = 2, column = 0)
passwordD = tkinter.StringVar(window)#value type is classified as a string
passwordEntry = ttk.Entry(window, width = 30, textvariable = passwordD)
passwordEntry.grid(row = 3, column = 0)
btn = ttk.Button(window, text="Submit", command=lambda: removeUser(usernameD, passwordD))
btn.grid(row = 3, column = 1)
def menu():
with sqlite3.connect("User.db") as db:
c = db.cursor()
c.execute("SELECT * FROM user")
print(c.fetchall())
window = tkinter.Tk()
window.title("Treasure Hunt Game!")
labelOne = ttk.Label(window, text = """ ~~~~~~~~~~~~~ USER MENU ~~~~~~~~~~~~~
""")#label displays instruction
labelOne.grid(row = 0, column = 0)#places label in a grid
btn = ttk.Button(window, text = "Create account", command = newUserTkinter)
btn.grid(row = 1, column = 0)#places button in a grid
btn = ttk.Button(window, text = "Delete account", command = removeUserTkinter)
btn.grid(row = 2, column = 0)#places button in a grid
labelTwo = ttk.Label(window, text = "Login to your account:")
labelTwo.grid(row = 3, column = 0)
usernameLogin = tkinter.StringVar(window)#value type is classified as a string
usernameEntry = ttk.Entry(window, width = 30, textvariable = usernameLogin)
usernameEntry.grid(row = 5, column = 0)
labelTwo = ttk.Label(window, text = "Username")
labelTwo.grid(row = 4, column = 0)
passwordLogin = tkinter.StringVar(window)#value type is classified as a string
passwordEntry = ttk.Entry(window, width = 30, textvariable = passwordLogin)
passwordEntry.grid(row = 7, column = 0)
labelTwo = ttk.Label(window, text = "Password")
labelTwo.grid(row = 6, column = 0)
btn = ttk.Button(window, text="Log in", command=lambda: login(usernameLogin, passwordLogin,window))
btn.grid(row = 7, column = 1)
#SQL QUESTION ADD/REMOVE/GET~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def insert_question(emp):
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("INSERT INTO game VALUES (?, ?, ?)", (emp))
conn.commit()
def get_question():
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("SELECT * FROM game")
return c.fetchall()
def get_number_total_question(): #Get the total number of question
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("SELECT COUNT(*) FROM game")
return c.fetchone()[0]
def get_single_question(question_number): #Get a question from the database
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("SELECT question FROM game WHERE questionID="+str(question_number))
return c.fetchone()[0]
def get_answer(question_number): #Get the answer from the database
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("SELECT answer FROM game WHERE questionID="+str(question_number))
return c.fetchone()[0]
def remove_question(emp):
conn = sqlite3.connect('games.db')
c = conn.cursor()
c.execute("DELETE from game WHERE question = ?", [emp])
conn.commit()
#Tkinter~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def showInstructions():
messagebox.showinfo("Instructions", """You are a treasure hunter, your goal is to collect atleast 100
gold by the end of the game from treasure chests randomly scattered across the grid.There are 10 chests within a grid and
each treasure chest is worth 10 gold but can only be reclaimed 3 times before it is replaced by a bandit.
Landing on a bandit will cause you to lose all of your
gold and if all the chests have been replaced by bandits and you have less then 100 gold this means you lose!
Press enter to continue...""")#messagebox used for more simple functions (showing messages)
def showLeaderboard():
messagebox.showinfo("Leaderboard", "shows leaderboard")
def con():
messagebox.showinfo("Game", "Time to play!")
window.destroy()
def showQuestions():
emps = get_question()
messagebox.showinfo("List of questions/answers", emps)
def AddQuestion(mathquestion, mathanswer):
mathquestion1 = mathquestion.get()
mathanswer1 = mathanswer.get()
emp_1 = (None, mathquestion1, mathanswer1)
insert_question(emp_1)
messagebox.showinfo("Question inputed!")
emps = get_question()
print(emps)
def removeQuestion(DeleteQuestion):
exists = 0
while exists == 0:#Validates exsistence of question
DeleteQuestion1 = DeleteQuestion.get()
conn = sqlite3.connect('games.db')
c = conn.cursor()
findQuestion = ("SELECT * FROM game WHERE question = ?")
c.execute(findQuestion, [(DeleteQuestion1)])
if c.fetchall():
messagebox.showinfo("Delete qustion","Question deleted!")
exists = 1
else:
messagebox.showinfo("","Question does not exist")
break
remove_question(DeleteQuestion1)
def removeQuestionTk():
window = tkinter.Tk()
window.title("Remove a question.")
labelOne = ttk.Label(window, text = "Enter question to remove:")
labelOne.grid(row = 0, column = 0)
DeleteQuestion = tkinter.StringVar(window)#value type is classified as a string
questionEntry = ttk.Entry(window, width = 30, textvariable = DeleteQuestion)
questionEntry.grid(row = 1, column = 0)
btn = ttk.Button(window, text="Submit", command=lambda: removeQuestion(DeleteQuestion))
btn.grid(row = 1, column = 1)
def QuestionMenu():
with sqlite3.connect("games.db") as db:
c = db.cursor()
window = tkinter.Tk()
window.title("Treasure Hunt Game!")
labelOne = ttk.Label(window, text = """ ~~~~~~~~~~~~~ GAME MENU ~~~~~~~~~~~~~
""")#label displays instruction
labelOne.grid(row = 0, column = 0)#places label in a grid
btn = ttk.Button(window, text = "View instructions", command = showInstructions)
btn.grid(row = 1, column = 0)#places button in a grid
btn = ttk.Button(window, text = "View leaderboard", command = showLeaderboard)
btn.grid(row = 2, column = 0)
btn = ttk.Button(window, text = "View all questions", command = showQuestions)
btn.grid(row = 3, column = 0)
btn = ttk.Button(window, text = "Continue", command = con)
btn.grid(row = 4, column = 0)
labelTwo = ttk.Label(window, text = "Enter a math question:")
labelTwo.grid(row = 5, column = 0)
mathquestion = tkinter.StringVar()#value type is classified as a string
userEntryQ = ttk.Entry(window, width = 30, textvariable = mathquestion)
userEntryQ.grid(row = 6, column = 0)
labelTwo = ttk.Label(window, text = "Enter the answer to this question:")
labelTwo.grid(row = 7, column = 0)
mathanswer = tkinter.StringVar()
userEntryQ = ttk.Entry(window, width = 30, textvariable = mathanswer)
userEntryQ.grid(row = 8, column = 0)
btn = ttk.Button(window, text = "Submit", command=lambda: AddQuestion(mathquestion, mathanswer))
btn.grid(row = 8, column = 1)
btn = ttk.Button(window, text = "Remove a question", command = removeQuestionTk)
btn.grid(row = 9, column = 0)#places button in a grid
SQLUser()
SQLQuestion()
menu()
关于Python - Tkinter 如何在按下按钮后关闭窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55317187/
https://github.com/mattdiamond/Recorderjs/blob/master/recorder.js中的代码 我不明白 JavaScript 语法,比如 (functio
在 iOS 7 及更早版本中,如果我们想在应用程序中找到 topMostWindow,我们通常使用以下代码行 [[[UIApplication sharedApplication] windows]
我已经尝试解决这个问题很长一段时间了:我无法访问窗口的 url,因为它位于另一个域上..有一些解决方案吗? function login() { var cb = window.ope
是否可以将 FFMPEG 视频流传递到 C# 窗口?现在它在新窗口中作为新进程打开,我只是想将它传递给我自己的 SessionWindow。 此时我像这样执行ffplay: public void E
我有一个名为 x 的矩阵看起来像这样: pTime Close 1 1275087600 1.2268 2 1275264000 1.2264 3 1275264300 1.2
在编译时,发生搜索,grep搜索等,Emacs会在单独的窗口中创建一个新的缓冲区来显示结果,有没有自动跳转到那个窗口的方法?这很有用,因为我可以使用 n 和 p 而不是 M-g n 和 M-g p 移
我有一个启动 PowerShell 脚本的批处理文件。 批处理文件: START Powershell -executionpolicy RemoteSigned -noexit -file "MyS
我有一个基于菜单栏的应用程序,单击图标时会显示一个窗口。在 Mac OS X Lion 上一切正常,但由于某种原因,在 Snow Leopard 和早期版本的 Mac OS X 上会出现错误。任何时候
在 macOS 中,如何在 Xcode 和/或 Interface Builder 中创建带有“集成标题栏和工具栏”的窗口? 这是“宽标题栏”类型的窗口,已添加到 OS X 10.10 Yosemit
在浏览器 (Chrome) 中 JavaScript: var DataModler = { Data: { Something: 'value' }, Process: functi
我有 3 个 html 页面。第 1 页链接到第 2 页,第 2 页链接到第 3 页(为了简单起见)。 我希望页面 2 中的链接打开页面 3 并关闭页面 1(选项卡 1)。 据我了解,您无法使用 Ja
当点击“创建节点”按钮时,如何打开一个新的框架或窗口?我希望新框架包含一个文本字段和下拉菜单,以便用户可以选择一个选项。 Create node Search node
我有一个用户控件,用于编辑应用程序中的某些对象。 我最近遇到一个实例,我想弹出一个新的对话框(窗口)来托管此用户控件。 如何实例化新窗口并将需要设置的任何属性从窗口传递到用户控件? 感谢您的宝贵时间。
我有一个Observable,它发出许多对象,我想使用window或buffer操作对这些对象进行分组。但是,我不想指定count参数来确定窗口中应包含多少个对象,而是希望能够使用自定义条件。 例如,
我有以下代码,它打开一个新的 JavaFX 阶段(我们称之为窗口)。 openAlertBox.setOnAction(e -> { AlertBox alert = AlertBox
我要添加一个“在新窗口中打开”上下文菜单项,该菜单项将以新的UIScene打开我的应用程序文档之一。当然,我只想在实际上支持多个场景的设备上显示该菜单项。 目前,我只是在检查设备是否是使用旧设备的iP
我正在尝试创建一个 AIR 应用程序来记录应用程序的使用情况,使用 AIR 从系统获取信息的唯一简单方法是使用命令行工具和抓取 标准输出 . 我知道像 这样的工具顶部 和 ps 对于 OS X,但它们
所以我有这个简单的 turtle 螺旋制作器,我想知道是否有一种方法可以打印出由该程序创建的我的设计副本。 代码: import turtle x= float(input("Angle: ")) y
我正在编写一个 C# WPF 程序,它将文本消息发送到另一个程序的窗口。我有一个宏程序作为我的键盘驱动程序 (Logitech g15) 的一部分,它已经这样做了,尽管它不会将击键直接发送到进程,而是
我尝试使用以下代码通过 UDP 发送,但得到了奇怪的结果。 if((sendto(newSocket, sendBuf, totalLength, 0, (SOCKADDR *)&sendAd
我是一名优秀的程序员,十分优秀!