简体   繁体   English

我想为某些功能制作gui,但它不像我想要的那样,我正在使用python 2.7和Tkinter?

[英]i wanna make gui for some function but it's not like what i want i am using python 2.7 and it's Tkinter?

i want to put that second entry in down to drop down menu help me to fix this? 我想将第二个条目放到下拉菜单中,以帮助我解决此问题? i tried with place and pack but i don't know where i am doing mistake help me to fix this you can specify the function and how to use it like width and height position ? 我尝试放置和打包,但是我不知道我在哪里做错了,请帮助我解决此问题。您可以指定功能以及如何使用它,例如宽度和高度位置?

import Tkinter as Tk
from Tkinter import *
network = Tk(className ="Network")
network.geometry('1000x600') # Size 200, 200
network.resizable(width=False,height=False)
svalue = StringVar() # defines the widget state as string
w = Entry(network,width=80,textvariable=svalue) # adds a textarea widget
w.pack(side=TOP and LEFT)
w.place(x=3,y=3)
button1 = Button(network,text="Press Me")
button1.pack()

# Add a grid
mainframe = Frame(network)
mainframe.grid(column=0,row=0, sticky=(N,W,E,S))
mainframe.columnconfigure(0, weight = 1)
mainframe.rowconfigure(0, weight = 1)
mainframe.place(x=10,y=30)

# Create a Tkinter variable
tkvar = StringVar(network)

# Dictionary with options
choices = { 'IP scanning','openport scanning','','Finding Emails based on domainname','OS footprinting'}
tkvar.set('IP scanning') # set the default option

popupMenu = OptionMenu(mainframe, tkvar, *choices)


button2=Button(mainframe, text="Choose any of them").grid(row = 1, column = 1)

popupMenu.grid(row = 2, column =1)

# on change dropdown value
def change_dropdown(*args):
    print(tkvar.get())

# link function to change dropdown
tkvar.trace('w', change_dropdown)
T = Text(network, height=20,width=60)
T.grid(row=3,column=0)
T.pack()
T.insert(END,"Just a text widget\nin two lines\n")

network.mainloop()

You can manually place the text area T under the pop up box by using the place function. 您可以使用place功能将文本区域T手动放置在弹出框下。 You give the x and y co-ordinates a value to place it where you want on the GUI. 您可以给x和y坐标赋予一个值,以将其放置在GUI上所需的位置。

T.place(y = 85) will place it under the pop up box. T.place(y = 85)将其放置在弹出框下面。 You can also give an x value to it. 您也可以给它一个x值。

There are a few other errors in your code too, but I hope this was what you were looking for. 您的代码中也存在其他一些错误,但是我希望这就是您想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我在使用Python 2.7的十进制函数时看不到期望值? - Why am I not seeing what I expect when I use Python 2.7's decimal function? 我想让gui应用程序与Tkinter在python中排序 - I want to make gui application for sorting in python with Tkinter 嗨,在 python 的新手中,我想使用 tkinter 为我的 python 脚本制作一个 GUI - Hi, in new to python and i want to make a GUI for my python script using tkinter 我正在尝试使用 tkinter 制作一个 GUI 应用程序 - I am trying to make a GUI application using tkinter 我想制作一个系统表单列的数据是必需的 - I wanna make a system form's column's data is required 如何使python的内置打印function,在gui(我正在制作REPL)上制作label而不是打印到控制台? - How to make python's built-in print function, make a label on a gui (I am making a REPL) instead of printing to console? 我想用 python 做一个秒表 - I wanna make a stopwatch with python 如何使用Tkinter制作类似Python Shell的GUI? - How can I make a Python shell-like GUI using Tkinter? 我想在python版本2.7的raw_input中使用%s - I want to use a %s in raw_input in python version 2.7 我想让两个单独的功能一个连接到 azure 存储并使用下面的 python 创建表是我想要做的 - I want to make two separate function one to connect to azure storage and create table using python below is what i am trying to do
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM