focus

My Tkinter GUI seems visually out of focus when opened

隐身守侯 提交于 2020-06-28 09:22:15
问题 When I open my GUI, I can type in it and do stuff, but the OptionMenu and Button widgets look as if the GUI is out of focus. A picture to demonstrate what I mean: (take a look at the dropdown menus and the buttons) After I focus on a different app and then click on my GUI again, it has the right colors which should be there if it is in focus. Once again a picture so it is clearer what I mean: So my question is, does anyone know why this is happening and what I should do so that the GUI is

My Tkinter GUI seems visually out of focus when opened

纵然是瞬间 提交于 2020-06-28 09:22:10
问题 When I open my GUI, I can type in it and do stuff, but the OptionMenu and Button widgets look as if the GUI is out of focus. A picture to demonstrate what I mean: (take a look at the dropdown menus and the buttons) After I focus on a different app and then click on my GUI again, it has the right colors which should be there if it is in focus. Once again a picture so it is clearer what I mean: So my question is, does anyone know why this is happening and what I should do so that the GUI is

Removing dotted border without setting NoFocus in Windows PyQt

℡╲_俬逩灬. 提交于 2020-06-24 06:07:07
问题 There are a few questions on SO about this, all of which seem to say that the only way to remove the dotted border is to set the focusPolicy on widget/item in question to NoFocus. While this works as a temporary fix, this prevents further interaction with said widget/item in the realm of other necessary focusEvents. Said border in question: Here's an example of why this doesn't work. I have a Non-Modal widget popup, think a lightbox for an image. I want to detect a mousePressEvent outside of

WPF Popup tab key bug

本小妞迷上赌 提交于 2020-06-23 03:51:32
问题 I have a WPF Popup control with a ListBox and a Button in it. When I click the Button , it should become disabled. The problem is, that when I disable the Button, the Tab key goes out from the Popup. I tried to set the focus to the ListBox, after I set the Button's IsEnabled to false, but that did not work. So, how can I set the tab focus to the ListBox inside the Popup control ? Here is my code. Window1.xaml: <Window x:Class="WpfApplication5.Window1" xmlns="http://schemas.microsoft.com/winfx

How to remove focus from currently focused component?

╄→гoц情女王★ 提交于 2020-06-22 10:23:46
问题 I have a DB component which DataLink.UpdateRecord is called when it receives CM_EXIT message. This message is sent when it loses focus. When I click post button, it doesn't lose focus and value is not written to datasource. How can I reach an effect of component losing focus without switching it to other one? 回答1: You could use: procedure TCustomForm.DefocusControl(Control: TWinControl; Removing: Boolean); 回答2: We accomplish this by setting the Self.ActiveControl := nil. That causes all of

jQuery Set Cursor to Beginning of Input Field on Focus

喜夏-厌秋 提交于 2020-06-16 04:52:12
问题 I have an input field <input value="@website.com" type="text" name="email" id="email"> and I want to make it so when a user focuses on this field, it will move the cursor to be before the @website.com . I have the following Javascript/jQuery code but it does not seem to work: $(document).ready(function() { $("#email").focusin(function(){ $("#email").focus(); $("#email")[0].setSelectionRange(0,0); }); }); It seems like the .focus() keeps calling the focusin() function. I know $("#email")[0]

How to handle, when tkinter window gets focus

随声附和 提交于 2020-05-29 09:08:06
问题 I have this code: from tkinter import * w = Tk() w.protocol('WM_TAKE_FOCUS', print('hello world')) mainloop() It prints hello world only once, and then it stops working. No more hello world Basically WM_TAKE_FOCUS does not work. 回答1: You can bind a function to the <FocusIn> event. When you bind to the root window the binding is applied to every widget in the root window, so if you only want to do something when the window as a whole gets focus you'll need to compare event.widget to the root

How to handle, when tkinter window gets focus

心不动则不痛 提交于 2020-05-29 09:07:11
问题 I have this code: from tkinter import * w = Tk() w.protocol('WM_TAKE_FOCUS', print('hello world')) mainloop() It prints hello world only once, and then it stops working. No more hello world Basically WM_TAKE_FOCUS does not work. 回答1: You can bind a function to the <FocusIn> event. When you bind to the root window the binding is applied to every widget in the root window, so if you only want to do something when the window as a whole gets focus you'll need to compare event.widget to the root

Javascript focus on browse button of file input

 ̄綄美尐妖づ 提交于 2020-05-16 08:05:30
问题 I am trying to focus on the browse button of the file input control. so I have something like <input type="file" name="upload" id="upload" > and in javascript I have document.getElementById("upload").focus(); but the focus remain on the text field and comes to browse button only after i hit tab. Is there a way that I could write a script to set the focus on the browse button? Thanks for your help! 回答1: Can't be done. You have almost zero control over the constituent parts of a file upload

How can I make a specific TabItem gain focus on a TabControl without click event?

允我心安 提交于 2020-05-12 11:23:48
问题 How can I tell my TabControl to set the focus to its first TabItem, something like this: PSEUDO-CODE: ((TabItem)(MainTabControl.Children[0])).SetFocus(); 回答1: How about this? MainTabControl.SelectedIndex = 0; 回答2: this.tabControl1.SelectedTab = this.tabControl1.TabPages["tSummary"]; I've found it's usually a best practice to name your tabs and access it via the name so that if/when other people (or you) add to or subtact tabs as part of updating, you don't have to go through your code and