当前位置: 首页>>代码示例>>Python>>正文


Python swing.JFrame类代码示例

本文整理汇总了Python中javax.swing.JFrame的典型用法代码示例。如果您正苦于以下问题:Python JFrame类的具体用法?Python JFrame怎么用?Python JFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle

 def handle(self):
     print 'connection from', self.client_address
     conn = self.request
     while 1:
         msg = conn.recv(20)
         if msg == "keymap":
             print "keymapping!"
             keymapFrame = JFrame('Key Mapping Configuration',
                            defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
                            size = (300, 500)
                            )
             keyButton = JButton('Press any key in iPhone')
             keymapFrame.add(keyButton)
             keymapFrame.visible = True
             while 1:
                 recvKey = conn.recv(20)
                 keyButton.setLabel("%s?" % recvKey)
                 keyInput = raw_input()
                 keynum[recvKey] = keyInput
                 keyButton.setText('Press any key in iPhone')
                 if recvKey == "keymap":
                     keymapFrame.visible = False
                     break
         if msg == "quit()":
             conn.close()
             print self.client_address, 'disconnected'
             break
         print self.client_address, msg
开发者ID:jooneyp,项目名称:PhoyStick,代码行数:28,代码来源:keyListener.py

示例2: __init__

    def __init__(self, channels):
        JFrame.__init__(self, "Informa Example News Client")
        self.setSize(400, 400)
        self.addWindowListener(BasicWindowMonitor())

        self.channels = channels
        self.channel_dict = None

        self.channelTree = None
        self.channelPanel = None
        self.itemTable = None

        self.mediator = MainMediator(self)
        
        # items (in table)
        itemScrollPane = JScrollPane(self.getItemTable())

        # channels (as tree)
        channelScrollPane = JScrollPane(self.getChannelTree())

        # put together channel info with item table
        ch_and_items = JPanel()
        ch_and_items.setLayout(BorderLayout())
        ch_and_items.add(self.getChannelPanel(), BorderLayout.NORTH)
        ch_and_items.add(itemScrollPane, BorderLayout.CENTER)

        # final step
        sp = JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                        channelScrollPane, ch_and_items)
        # print "dividerLocation", sp.getDividerLocation()
        # sp.setDividerLocation(0.5)
        self.getContentPane().add(sp, BorderLayout.CENTER)
开发者ID:optivo-org,项目名称:informa-0.7.0-optivo,代码行数:32,代码来源:minigui.py

示例3: UI

class UI(object):
    def __init__(self, game):

        self.frame = JFrame("Tic Tac Toe",
                             defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE)

        self.panel = JPanel(GridLayout(3,3))
        self.buttons = []
        self.game = game
        for row in range(3):
            for col in range(3):
                self.buttons.append(TicTacButton(row,col,'',actionPerformed=self.clicked_button))

        self.panel.add
        self.frame.add(self.panel)
        for b in self.buttons:
            self.panel.add(b)

        self.frame.pack()
        self.show()


    def show(self):
        self.frame.size = 600,600
        self.frame.visible = True


    def clicked_button(self, event):
        button = event.getSource()
        print 'current_player', self.game.current_player
        if self.game.current_player.level == 'human' and self.game.state=='next':
            button.text = self.game.current_player.xo
            self.game.update(button)
        else:
            pass
开发者ID:mykemouuuse,项目名称:TicTac_AI,代码行数:35,代码来源:tictacdax.py

示例4: run

    def run(self):
        frame = JFrame('MainFrame', defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE)
        self.addButtons(frame.getContentPane())
        frame.size = (300, 175)
        frame.visible = 1 

        self.frame = frame
        self.startTimerTask()
开发者ID:ToroLiu,项目名称:gt_cg2scripts,代码行数:8,代码来源:BattleScripts.py

示例5: __init__

 def __init__(self, title="Development Reloader Window"):
     if jython:
         JFrame.__init__(self, title, windowClosing=self.OnClose)
         self.setBounds(0, 0, 300, 550)
     else:
         self.window = MakeWindow("pyGTK Python Reloader window", 200, 500)
         
     self.BuildWindow()
开发者ID:Cybernetic-Shadow,项目名称:PlantStudio,代码行数:8,代码来源:reloader.py

示例6: show

def show():
    """ adapted from here: http://wiki.gephi.org/index.php/Toolkit_-_Reuse_the_Preview_Applet"""
    from javax.swing import JFrame
    from java.awt import BorderLayout

    pc = PreviewController
    pc.refreshPreview();
     
    # New Processing target, get the PApplet
    target = pc.getRenderTarget("processing")
    applet = target.getApplet()
    applet.init()
     
    # Refresh the preview and reset the zoom
    try:
        pc.render(target) 
    except Exception:
        # throws sun.dc.pr.PRError: sun.dc.pr.PRError: setPenT4: invalid pen transformation (singular)
        pass
    target.refresh()
    target.resetZoom()
     
    # Add the applet to a JFrame and display
    frame = JFrame("Preview")
    frame.setLayout(BorderLayout())
     
    # frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
    frame.add(applet, BorderLayout.CENTER)
     
    frame.pack()
    frame.setVisible(True)
开发者ID:bingpan1,项目名称:programming-language-network,代码行数:31,代码来源:gephi.py

示例7: test_swing

def test_swing():
    frame = JFrame("Hello Jython")
    button = JButton("Pulsar", actionPerformed = hello)
    frame.add(button)
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
    frame.setSize(200, 100)
    frame.show()
开发者ID:blakbox,项目名称:curso_python_dga_11,代码行数:7,代码来源:swingexample.py

示例8: __init__

class _AccountAdder:
    def __init__(self, contactslist):
        self.contactslist = contactslist
        self.mainframe = JFrame("Add New Contact")
        self.account = JComboBox(self.contactslist.clientsByName.keys())
        self.contactname = JTextField()
        self.buildpane()

    def buildpane(self):
        buttons = JPanel()
        buttons.add(JButton("OK", actionPerformed=self.add))
        buttons.add(JButton("Cancel", actionPerformed=self.cancel))

        acct = JPanel(GridLayout(1, 2), doublebuffered)
        acct.add(JLabel("Account"))
        acct.add(self.account)

        mainpane = self.mainframe.getContentPane()
        mainpane.setLayout(BoxLayout(mainpane, BoxLayout.Y_AXIS))
        mainpane.add(self.contactname)
        mainpane.add(acct)
        mainpane.add(buttons)
        self.mainframe.pack()
        self.mainframe.show()

    #action listeners
    def add(self, ae):
        acct = self.contactslist.clientsByName[self.account.getSelectedItem()]
        acct.addContact(self.contactname.getText())
        self.mainframe.dispose()

    def cancel(self, ae):
        self.mainframe.dispose()
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:33,代码来源:jychat.py

示例9: gui_open

 def gui_open(path):
     label = JLabel(ImageIcon(ImageIO.read(File(URL(path).getFile()))))
     frame = JFrame()
     frame.getContentPane().add(label)
     frame.pack()
     frame.setLocation(200, 200)
     frame.setVisible(True)
开发者ID:ppawlak,项目名称:pystacia,代码行数:7,代码来源:compat.py

示例10: ConversationWindow

class ConversationWindow(Conversation):
    """A GUI window of a conversation with a specific person"""
    def __init__(self, person, chatui):
        """ConversationWindow(basesupport.AbstractPerson:person)"""
        Conversation.__init__(self, person, chatui)
        self.mainframe = JFrame("Conversation with "+person.name)
        self.display = JTextArea(columns=100,
                                 rows=15,
                                 editable=0,
                                 lineWrap=1)
        self.typepad = JTextField()
        self.buildpane()
        self.lentext = 0

    def buildpane(self):
        buttons = JPanel(doublebuffered)
        buttons.add(JButton("Send", actionPerformed=self.send))
        buttons.add(JButton("Hide", actionPerformed=self.hidewindow))

        mainpane = self.mainframe.getContentPane()
        mainpane.setLayout(BoxLayout(mainpane, BoxLayout.Y_AXIS))
        mainpane.add(JScrollPane(self.display))
        self.typepad.actionPerformed = self.send
        mainpane.add(self.typepad)
        mainpane.add(buttons)

    def show(self):
        self.mainframe.pack()
        self.mainframe.show()

    def hide(self):
        self.mainframe.hide()

    def sendText(self, text):
        self.displayText("\n"+self.person.client.name+": "+text)
        Conversation.sendText(self, text)

    def showMessage(self, text, metadata=None):
        self.displayText("\n"+self.person.name+": "+text)

    def contactChangedNick(self, person, newnick):
        Conversation.contactChangedNick(self, person, newnick)
        self.mainframe.setTitle("Conversation with "+newnick)

    #GUI code
    def displayText(self, text):
        self.lentext = self.lentext + len(text)
        self.display.append(text)
        self.display.setCaretPosition(self.lentext)

    #actionlisteners
    def hidewindow(self, ae):
        self.hide()

    def send(self, ae):
        text = self.typepad.getText()
        self.typepad.setText("")
        if text != "" and text != None:
            self.sendText(text)
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:59,代码来源:jychat.py

示例11: start_ashdi

def start_ashdi():
    loadKeyLayout("data_2.0/ashdi_keylayout.xml")

    global frame
    frame = JFrame(FRAME_TITLE)
    frame.setContentPane(getContentPane())
    frame.windowClosing = lambda x: windowClosing()
    frame.pack()
    frame.setVisible(True)
    frame.addWindowFocusListener(GuiWindowFocusListener())
    start_android_waker()
    handleConnectedDevBtn(True)
    check_move_support()
开发者ID:sjp38,项目名称:ash,代码行数:13,代码来源:ashdi.py

示例12: __init__

 def __init__(self):
     JFrame.__init__(self, 'MagicDraw Jython Console')
     # grab the current out and err so we can set them back later (for the main java
     # System.out/err, not the PythonInterpreter
     self.__outOriginal = System.out
     self.__errOriginal = System.err
     # use the printStream as it updates the textarea
     System.setOut(self.printStream)
     System.setErr(self.printStream)
     self.CreateComponents()
     self.setVisible(True) 
     self.requestFocus()
     self.inputField.requestFocus()
开发者ID:thecaffiend,项目名称:MagicDrawJythonTerminal,代码行数:13,代码来源:MagicDrawJythonTerminal.py

示例13: readSVG

def readSVG(svgPath):
	#parser = XMLResourceDescriptor.getXMLParserClassName()
	#f = SAXSVGDocumentFactory(parser)
	#print(svgPath)
	#doc = f.createDocument(svgPath.toURI().toString())
	#print(doc)
	svgCanvas = JSVGCanvas()
	svgCanvas.setURI(svgPath.toURI().toString())
	f = JFrame('SVG image', size=(1000, 1000), locationRelativeTo=None)
	p = JPanel()
	p.add(svgCanvas)
	f.getContentPane().add(p)
	f.setVisible(True)
开发者ID:mbarbie1,项目名称:fiji-registration-plugins,代码行数:13,代码来源:Convert_ROI_v2.py

示例14: __init__

class View:
    def __init__(self):
        self.stats=None
        self.frame=JFrame('Statistics',visible=True,layout=BorderLayout())

        self.graph=GraphPanel(self,componentResized=lambda event: self.graph.update())
        self.frame.add(self.graph)

        self.options=OptionsPanel(self)
        self.frame.add(self.options,BorderLayout.WEST)


        self.model_selection=ModelSelectionPanel(self)
        self.frame.add(self.model_selection,BorderLayout.NORTH)

        self.frame.add(RunPanel(self),BorderLayout.SOUTH)

        self.frame.size=(800,600)
    def selected_params(self):
        return self.options.parameters.get_selected()

    def file_changed(self,event):
        if event.stateChange==ItemEvent.SELECTED:
            self.select_model(event.item)



    def select_model(self,name):
        self.model_selection.files.selectedItem=name
        self.stats=stats.Stats(name)
        self.options.update()
        self.graph.update()
开发者ID:Elhamahm,项目名称:nengo_1.4,代码行数:32,代码来源:core.py

示例15: VacalcFrame

class VacalcFrame(object):
    def __init__(self, employees, dateprovider):
        self._frame = JFrame("Vacation Calculator", defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
        self._frame.setContentPane(self._create_ui(employees, dateprovider))
        self._frame.pack()

    def _create_ui(self, employees, dateprovider):
        panel = JPanel(layout=FlowLayout())
        self._overview = EmployeeOverview(employees, self)
        self._details = EmployeeDetails(employees, dateprovider)
        self._welcome = Welcome()
        panel.add(self._overview)
        panel.add(self._welcome)
        return panel

    def show(self):
        self._frame.setVisible(True)

    def employee_selected(self, employee):
        self._ensure_details_shown()
        self._details.show_employee(employee)

    def edit_new_employee(self):
        self._ensure_details_shown()
        self._details.edit_new_employee()

    def _ensure_details_shown(self):
        if self._welcome:
            self._frame.contentPane.remove(self._welcome)
            self._frame.contentPane.add(self._details)
            self._frame.pack()
            self._welcome = None
开发者ID:Radhika-Goel,项目名称:atdd-with-robot-framework,代码行数:32,代码来源:ui.py


注:本文中的javax.swing.JFrame类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。