标签: user-interface

使用 winapi 进行 GUI 设计的“完整”参考

虽然我们在互联网上有很多资源,但有时它并不能如我们所愿。有没有关于使用winapi进行GUI设计的好书?事实上,我需要有一个带有几个子窗口的主窗口。

c++ user-interface winapi

-1
推荐指数
1
解决办法
372
查看次数

将目录名称传递给askopenfilename

我有三个功能;用户选择dirBut一个目录,其输出进入dirname并更新一个Entry框。在第三个函数 中,dataInput用户选择一个文件。我希望打开文件对话框在用户先前选择并由 定义的目录中打开dirname,但是,我不确定如何传递dirname给句柄,以便我可以使用它,因为askopenfilenameaskdirectory从按钮调用的。

def UserFileInput(self,status,name):
    row = self.row
    optionLabel = tk.Label(self)
    optionLabel.grid(row=row, column=0, sticky='w')
    optionLabel["text"] = name
    text = status
    var = tk.StringVar(root)
    var.set(text)
    w = tk.Entry(self, textvariable= var)
    w.grid(row=row, column=1, sticky='ew')
    self.row += 1

    return w, var


def askdirectory(self):
    dirname = tkFileDialog.askdirectory()
    if dirname:
      self.directoryEntry.delete(0, tk.END)
      self.directoryEntry.insert(0, dirname)


def askfilename(self):
  filename = tkFileDialog.askopenfilename(initialdir=dirname)
  if filename:
    self.dataInput.delete(0, tk.END)
    self.dataInput.insert(0, filename)

currentDirectory = os.getcwd()
directory,var …
Run Code Online (Sandbox Code Playgroud)

python user-interface tkinter

-1
推荐指数
1
解决办法
8722
查看次数

如何从不同的类定义多个JButton操作

我正在编写一个程序,我需要根据单击的按钮为单独的类执行不同的操作.

public class NewJFrame{
    public static JButton b1;
    public static JButton b2;
    public static JButton b3;
}

public class Slot{

    int value;
    JButton button;

    Slot(int value, JButton button)
    {
        this.value=value;
        this.button=button;
    }
}

public class Game{
    Slot[] slots=new Slot[3];
    Game(){
        slots[0]=new Slot(1,NewJFrame.b1);
        slots[1]=new Slot(2,NewJFrame.b2);
        slots[2]=new Slot(3,NewJFrame.b3);
    }
    public void actionPerformed(ActionEvent e) {
        for(int i=0;i<3;i++){
            if(e.getSource()==slots[i].button)
                slots[i].button.setText(String.valueOf(value));
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

像这样的东西.请注意,我完全是GUI设计的新手.

java user-interface swing awt

-1
推荐指数
1
解决办法
570
查看次数

Python Tkinter 程序因 Entry 崩溃

一直试图用 tkinter 创建一个简单的 gui 计算器,但是一旦我添加了 e = Entry(root) e.pack() 它就会在启动时崩溃我的程序?删除它会使我的程序正常运行吗?很困惑为什么要这样做,并想知道它是否是我拥有多少代码的原因?

import sys
from tkinter import *
import webbrowser
import time

# window Defaults



root = Tk()
root.title("Calculator")
root.geometry("319x212")
root.configure(background="#3b3b3b")
root.iconbitmap("Calculator.ico")

e = Entry(root)
e.pack()




# Addition Numbers

total = 0

def plusOne():
    global total
    total += 1
    print(total)
def plusTwo():
    global total
    total += 2
    print(total)
def plusThree():
    global total
    total += 3
    print(total)
def plusFour():
    global total
    total += 4
    print(total)
def plusFive():
    global total
    total += 5
    print(total) …
Run Code Online (Sandbox Code Playgroud)

python user-interface tkinter calculator tkinter-entry

-1
推荐指数
1
解决办法
249
查看次数

保存数据并同时关闭 Tkinter 窗口

所以我试图从用户那里获取数据,然后我希望 gui 窗口关闭,并在他们单击“Enter”后立即将数据保存到我的代码的变量中。但窗户就停留在那里。我如何让它保存数据,同时关闭 gui 窗口?

#pop up window
def show_entry_fields():
   global ModelNumber,PowerOutput,SerialNumber

   ModelNumber=e1.get()
   PowerOutput=e2.get()
   SerialNumber=e3.get()

master = Tk()
master.title("Model Information")

master.geometry("500x300")

master.iconbitmap("square.ico")

Label(master, text="Model Information").grid(row=0,column=1)
Label(master, text="Model Number ").grid(row=2)
Label(master, text="Power Output (w)").grid(row=3)
Label(master,text="Serial Number").grid(row=4)


e1 = Entry(master)
e2 = Entry(master)
e3 = Entry(master)


e1.grid(row=2, column=1)
e2.grid(row=3, column=1)
e3.grid(row=4, column=1)


Button(master, text='Enter', command=show_entry_fields).grid(row=6, 
column=1, sticky=W, pady=4)




mainloop()
master.withdraw()
Run Code Online (Sandbox Code Playgroud)

python user-interface tkinter

-1
推荐指数
1
解决办法
1479
查看次数

C#Bunifu UI System.NullReferenceException未处理

我正在使用Bunifu UI框架,一切都很好,直到我从Bunifu UI中添加了一个“退出”按钮,该按钮为bunifuFlatButton,我同时尝试了this.Close();。和Close(); 并与我都得到System.NullReferenceException是未处理的错误。

按键:

在此处输入图片说明

错误:

在此处输入图片说明

System.NullReferenceException was unhandled
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=Bunifu_UI_v1.5.3
  StackTrace:
       at Bunifu.Framework.UI.BunifuFlatButton.method_5()
       at Bunifu.Framework.UI.BunifuFlatButton.BunifuFlatButton_MouseClick(Object sender, MouseEventArgs e)
       at System.Windows.Forms.Control.OnMouseClick(MouseEventArgs e)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.Label.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) …
Run Code Online (Sandbox Code Playgroud)

c# user-interface button winforms bunifu

-1
推荐指数
1
解决办法
1509
查看次数

如何使用Java Swing设置此GUI?

我有一个GUI,我已经尝试了很多方法,但我似乎无法正确构建它,我总是得到错误的布局,我的应用程序搞砸了.我只是想要一些帮助,如何在图像中构建一些接近GUI的东西,除了图像部分,这是不必要的.不需要完全像它,我只需要一些关于使用什么布局和如何使用的想法.谢谢 1]

java user-interface swing layout-manager

-1
推荐指数
1
解决办法
48
查看次数

如何使用纯 CSS 实现活动侧边栏项目的向外曲线

过去一周我一直在学习前端设计,我试图复制我在运球时看到的设计,但我一直很难复制侧边栏上的主动风格,这是向外曲线的原因。

如果有人能帮助我解决如何实现它,我会很高兴。

除了活动侧边栏项目上的向外曲线之外,我已经能够实现其他功能。

我无法发布图片,因为我的声誉不到 10,所以我添加了设计的链接

https://cdn.dribbble.com/users/1192538/screenshots/6973301/flight_web1.png

html css user-interface user-experience

-1
推荐指数
1
解决办法
1030
查看次数

有什么方法可以通过右键单击在 Tkinter 列表框中选择一个项目?

我希望能够使用左键单击或右键单击在 Tkinter 列表框中选择一个项目。有什么方法可以绑定"<button-3>"到某种选择项目的函数,或者在将鼠标悬停在列表框上时从右键单击调用左键单击?

python user-interface tkinter

-1
推荐指数
1
解决办法
473
查看次数

如何在 Java Swing GUI 中设置字母间距?

在 CSS 中,我们可以使用一个letter-spacing属性来增加单词中每个字母的间距。

有没有办法增加字母空间或文本空间?我希望我可以增加字段中文本的空间。

java user-interface swing jtextfield

-1
推荐指数
1
解决办法
291
查看次数