user-interface

Python - how to wait for user trigger in the middle of a function?

你说的曾经没有我的故事 提交于 2021-02-05 11:12:27
问题 I want to prompt user to choose between yes and no in the middle of a function and then continue the function accordingly. How is it possible? Here is my code: def download_popup(file_name, url, size, threshold): root = Tk() label = Label(root, text="The file {file} at {url} is {size}Bytes large which is larger than your threshold({threshold})." "\nShall I still download it?".format(file_name, url, size, threshold)) yes = ttk.Button(root, width=5, text="yse", command=lambda: return True) no =

Running a thread with Tkinter object

流过昼夜 提交于 2021-02-05 09:46:39
问题 When I push the button the scan_open_ports start working until the line ip_list.curselection() where it stops, this line blocks the running of the function... I wanted to know why and how to fix that? Thanks def scan_open_ports(): #long runtime function print "Asdasd\" ip_list.curselection() def thr_open_ports(): threading.Thread(target=scan_open_ports).start() ip_list = Listbox() scan_ports = Button(window, text="Scan Open Ports", command= thr_open_ports, height = 10, width = 20) 回答1: I have

MATLAB - GUI and OPC server

纵饮孤独 提交于 2021-02-05 09:25:07
问题 I want to design a graphical user interface in MATLAB that can read data continuously using the MATLAB's object linking and embedding for process control (OPC) toolbox. How can I implement this? I have designed the graphical user interface, but I'm not able to read the data into the graphical user interface. 回答1: Take a look at this submission of mine from the MATLAB Central File Exchange. It gives a full example of how to read and write data from an OPC server, and how to create and compile

Matlab makes the loops run simultaneously

我的梦境 提交于 2021-02-05 08:11:59
问题 Unfortunately, I have two loops. that's why my code makes the first loop run and only when it is finished, it makes the second loop run. But I want the gui to show the data simultaneously: in the hAxes and in the loading1. How can I make it? hFigure = figure('units','pixels','position',[300 300 424 470],'menubar','none',... 'name','start processing','numbertitle','off','resize','off'); hAxes = axes('Parent',hFigure,'Units','pixels','Position',[0 112 424 359]); loading1 = uicontrol('style',

Close window - but don't stop program - JAVA

纵饮孤独 提交于 2021-02-05 08:09:15
问题 In my program it opens a window if an action is happened. After I have filled out information in this window, and entered a button, the window dispose(). The window is picked up in a program outside my main program, but when I close this window, my main program stops. How can I prevent this from happening? Thanks for your help! 回答1: You can set the defalaultCloseOperation property of the second frame to DO_NOTHING_ON_CLOSE or DISPOSE_ON_CLOSE Don't even use two frames. Use a modal JDialog

How to open user interface with opening the file

旧街凉风 提交于 2021-02-05 07:47:06
问题 I am using : Private Sub start_Click() UserForm1.Show End Sub To open my user interface by pushing the start button. But, I would like my user interface to be opened automatically in the very beginning when I have just opened my excel file. Does anyone know how I can do that? 回答1: In the Workbook code pane type this Private Sub Workbook_Open() UserForm1.Show End Sub 回答2: Create a subroutine in your workbook named Workbook_Open Private Sub Workbook_Open() MsgBox "yo!" End Sub You can call

Revalidate JPanel's parent frame

安稳与你 提交于 2021-02-05 07:09:25
问题 I want my panel to fit the frame when I show/hide fields. How could I notify to the parent frame to revalidate? I thought about pass the frame to my panel's constructor, but I think may have a way this is already done. I remember that there was a protected attribute in JPanel, but there isn't.. maybe i remembering the wrong component. 回答1: I need show/hide some fields of my panel, and I want the panel to fit the frame. You mean like a summary/details view and you want the frame size to change

Tkinter: All radio buttons are already selected

被刻印的时光 ゝ 提交于 2021-02-05 06:05:38
问题 it is my first time using tkinter. I have an entry box on the first window, and I created radio buttons on different windows. The problem is that they are already selected before I click any of them. How can I change all buttons to be deselected? I am not sure if my codes are right or not. from tkinter import * from tkinter import messagebox class SortingHat: # Constructor def __init__(self): # Create main window self.__main_window = Tk() self.__main_window.geometry('300x200') self.__main

tkinter keeping window on top all times on MacOS

北城以北 提交于 2021-02-04 21:24:00
问题 I'm trying to create a screen "curtain" which blocks parts of the screen except for the mouse cursor's vicinity. On windows, using root.wm_attributes("-topmost", "true") keeps the window on top, even if I focus on another app, perfectly. However, upon running the code on MacOS, if the focus for the window is lost, it will not keep itself on topmost. What would be the MacOS equivalent to -topmost window manager attribute which will always keep the window on top, regardless of focus? import

tkinter keeping window on top all times on MacOS

房东的猫 提交于 2021-02-04 21:22:56
问题 I'm trying to create a screen "curtain" which blocks parts of the screen except for the mouse cursor's vicinity. On windows, using root.wm_attributes("-topmost", "true") keeps the window on top, even if I focus on another app, perfectly. However, upon running the code on MacOS, if the focus for the window is lost, it will not keep itself on topmost. What would be the MacOS equivalent to -topmost window manager attribute which will always keep the window on top, regardless of focus? import